Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

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
Esteemed Contributor

Re: 'Count if' of simple text values

take a bar chart and in expression

use below code

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

or you can

see the attached file

9 Replies
Highlighted
MVP
MVP

'Count if' of simple text values

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

'Count if' of simple text values

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

Not applicable

'Count if' of simple text values

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
Esteemed Contributor

Re: 'Count if' of simple text values

take a bar chart and in expression

use below code

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

or you can

see the attached file

Not applicable

'Count if' of simple text values

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

ScreenShot005.jpg

SunilChauhan
Esteemed Contributor

Re: 'Count if' of simple text values

relative is not serving the purpose  i belive

Not applicable

'Count if' of simple text values

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

Much Thanks! Arthur

SunilChauhan
Esteemed Contributor

'Count if' of simple text values

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 .

Not applicable

Re: 'Count if' of simple text values

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