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 if' of simple text values

Dear All,

I can't manage to simply count particular text values in a field with the 'count if' expression. Who could help me with this?

Much thanks. Arthur

1 Solution

Accepted Solutions
SunilChauhan
Champion
Champion

take a bar chart and in expression

use below code

Count(if(Male='true',Employee))/count(Male)

or you can

see the attached file

Sunil Chauhan

View solution in original post

9 Replies
swuehl
MVP
MVP

Not sure if I completely understand, but maybe like

=sum( if(match(YOURFIELD,'TextA','TextB','TextC'),1,0) )

You could also use Wildmatch to use wildcards in your search.

Not applicable
Author

Artur - is it possible that you can maybe ellaborate please - maybe with an example.

Not applicable
Author

See the images.

I want a bar chart showing me the percentage of MALE employees / Total number of employees.

So how can I count 'true' and divide this by total number of employees.

It must be 60% but I can't figure out how to enclose this into an graph expression.

Much thanks to help me as beginner.

count if TRUE.png

SunilChauhan
Champion
Champion

take a bar chart and in expression

use below code

Count(if(Male='true',Employee))/count(Male)

or you can

see the attached file

Sunil Chauhan
Not applicable
Author

Why didn't you just count the number of employee and check the option "Relative" ?

ScreenShot005.jpg

SunilChauhan
Champion
Champion

relative is not serving the purpose  i belive

Sunil Chauhan
Not applicable
Author

Thanks Sunil, you fixed my problem. The 'relative' option doesn't fit for now, but good to knwo this option.

Much Thanks! Arthur

SunilChauhan
Champion
Champion

first of all mark this as correct .which will indicate issue is closed .

relative  is best suited where distribution is required . like out of 100% , 20% is a,30% is b, 50% is a .

Sunil Chauhan
Not applicable
Author

Very helpful. I had a very similar problem and this method worked perfectly with wildmatch.