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

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

25 Replies
Miguel_Angel_Baeyens

Hi,

Distinct goes in the expression before the name of the field

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

Will return only the distinct values for NAME where AGE is less than or equal to zero and GENDER equals to "M".

Hope that helps.

Miguel

Not applicable
Author

whats the purpose of Distinct? What does it do?

Miguel_Angel_Baeyens

Hi,

Please read my post just above yours. You hve the answer there.

Miguel

Not applicable
Author

thanks ,

there is also a post of http://community.qlik.com/message/79906#79906 about the word DISTINCT, it basically does not count any duplicate

Cheers

Anonymous
Not applicable
Author

Any thoughts on how to implemet the script flag concept described above so I can get a flag

If (Count(IP_Name0>1, count(IP_Name)       (Used in Chart now)

Could be modified to

(So far so good...)

but I only want to do it when the count of IP_Name (>1) is distinct to IP_Location.

Essentially, if the same IP_Name exists more than once at a distinct IP_Location, I want "Flag_Dupe" in the script.

dukane24
Contributor III
Contributor III

Hello,

Could somebody please provide an example on the syntax for "Count" when including a function? The expression below worked before I added in the piece with the "Today" function.  It doesn't seem appropriate to put it in quotes because it's not a string.  Any suggestions would be appreciated.  Thanks!

count({<[Current Status]-={'Completed','Withdrawn'},[Est. Completion Date]<{Today(1)}>}[Project/Event Name])