Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Not applicable

Marco, Check this helps you

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

- Sridhar

View solution in original post

25 Replies
Highlighted
Not applicable

Marco, Check this helps you

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

- Sridhar

View solution in original post

Highlighted
Not applicable

Thank you!!

It’s correct!

MArco

Highlighted
Not applicable

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

Highlighted
Not applicable

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

Highlighted
Not applicable

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

Highlighted
Not applicable

Macro,

try this

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

- Sridhar

Highlighted
Not applicable

It works!! Thank You a lot!

Marco

Highlighted
Not applicable

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

Highlighted
Not applicable

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