Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count number of string appearances

Hi there,

I have a data set like below.

I would like to count the number of times that RED appears and use that as the expression on a Guage chart.

Can any one help?

Task IDRAG Status
1RED
2GREEN
3GREEN
1 Solution

Accepted Solutions
HirisH_V7
Master
Master

Hi,

if([Status]='Open', Count({<[RAG Status] = {"RED"}>}[RAG Status]), null())


or


if([Status]='Open', Count({<[Status]={'Open'},[RAG Status] = {"RED"}>}[RAG Status]), null())



Will works Fine.In Your Table you should Suppress Null values at Presentation and Dimensions tab as well.

If your dimension is status means there you can see only Open as a field.

HTH,

Hirish


HirisH
“Aspire to Inspire before we Expire!”

View solution in original post

6 Replies
sunny_talwar

Try this:

To count Red

=SubStringCount(Concat([RAG Status], '|'), 'RED')

To count Green

=SubStringCount(Concat([RAG Status], '|'), 'Green')


or

=Count({<[RAG Status] = {'RED'}>}[RAG Status])

=Count({<[RAG Status] = {'GREEN'}>}[RAG Status])

Not applicable
Author

Hi There,

This doesn't seem to have worked unfortunately, the count is showing as the total number of rows in the table, rather than the number of instances where the value is RED

Count({<[RAG Status] = {"RED"}>}[Rag Status])

Thanks

sunny_talwar

I guess would you be able to share a application where it isn't working?

HirisH_V7
Master
Master

Hi ,

Change your Expression like this,

May be its ,


Count({<[Rag Status] = {"RED"}>}[Rag Status])


OR


Count({<[RAG Status] = {"RED"}>}[RAG Status])





HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

Can you help me a little bit here too:

So I've just added an if condition.


I want to count the number of RAG status where the status is open.

This doesn't seem to work - to confirm, the count now does work. Just need the if to work around it.

if([Status]='Open', Count({<[RAG Status] = {"RED"}>}[RAG Status]), null())

HirisH_V7
Master
Master

Hi,

if([Status]='Open', Count({<[RAG Status] = {"RED"}>}[RAG Status]), null())


or


if([Status]='Open', Count({<[Status]={'Open'},[RAG Status] = {"RED"}>}[RAG Status]), null())



Will works Fine.In Your Table you should Suppress Null values at Presentation and Dimensions tab as well.

If your dimension is status means there you can see only Open as a field.

HTH,

Hirish


HirisH
“Aspire to Inspire before we Expire!”