Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count If

Hi,

i need to count the variable NAME when the AGE is 18 or 19 and GENDER is M.

If there is only one condition ( for exemple AGE) i use: count({<AGE={'18','19'}>} NAME) and it works.

How can I introduce also the second condition (GENDER=M)?

Thank you

1 Solution

Accepted Solutions
Not applicable
Author

Marco, Check this helps you

count({<AGE={'18','19'},GENDER={'M'}>} NAME)

- Sridhar

View solution in original post

25 Replies
Not applicable
Author

Marco, Check this helps you

count({<AGE={'18','19'},GENDER={'M'}>} NAME)

- Sridhar

Not applicable
Author

Thank you!!

It’s correct!

MArco

Not applicable
Author

For a static test like that I would recommend you put the workload onto the script and use a flag, something like:

if ((AGE = 18 or AGE = 19) and GENDER = 'M', 1, 0) as YoungMaleFlag

then you can just use a simple expression in charts etc

sum(YoungMaleFlag)

Regards,

Gordon

Not applicable
Author

Hi Sridhar,

i' ve to do another similar count if.  This time i need to count all Name with gender M and age <=18.

I try to adapt your script like these:

count({<AGE<={'18'},GENDER={'M'}>} NAME).

It's not correct. Can you help me?

Thank you!

Marco

Not applicable
Author

Hi Sridhar,

i' ve to do another similar count if.  This time i need to count all Name with gender M and age <=18.

I try to adapt your script like these:

count({<AGE<={'18'},GENDER={'M'}>} NAME).

It's not correct. Can you help me?

Thank you!

Marco

Not applicable
Author

Macro,

try this

count({<AGE={"<=18"},GENDER={'M'}>} NAME)

- Sridhar

Not applicable
Author

It works!! Thank You a lot!

Marco

Not applicable
Author

Hi,

i've to do another type of count if;

AGE <= of a numeric variable "VARIABLE" like the example:

count({<AGE={"<=VARIABLE"},GENDER={'M'}>} NAME).

But i 've problem...

Marco

Not applicable
Author

Hi,

i've to do another type of count if;

AGE <= of a numeric variable "VARIABLE" like the example:

count({<AGE={"<=VARIABLE"},GENDER={'M'}>} NAME).

But i 've problem...

Can you help me again?

Marco