Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count on if condition

Please refer the table below:

   

I want an expression to count number if all the values design_accept=3.

Eg; If all the values for design_accept=3 for each MachDateKey then it should count as 1.

Please assist.

1 Solution

Accepted Solutions
sunny_talwar

How about this

Count({<MachDateKey = {"=design_accept = 3"}>} DISTINCT MachDateKey)

View solution in original post

14 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Mohammed,

Your expression like below:

Count({<design_accept={'3'}>}MachDateKey)

Thanks,

Arvind Patil

Anonymous
Not applicable
Author

Hi Arvind,

I am unable to get the desired result with the above expression.

I am aware of this expression and have used it already (Count({<design_accept={'3'}>} distinct MachDateKey) ) but even though sometimes not all values are equal to 3 , it is taking count for that MachDateKey.

So I need some count function which includes avg expression inside IF condition.

arvind_patil
Partner - Specialist III
Partner - Specialist III

O Got it.

write it on script level:


if(match (design_accept,'3') and not is null(MachDateKey) ,1,0) as Count3rd,


And in front end  expression :


count (distinct Count3rd)


Thanks,

Arvind Patil



Anonymous
Not applicable
Author

Not working..

Syntax error I guess

sunny_talwar

How about this

Count({<MachDateKey = {"=design_accept = 3"}>} DISTINCT MachDateKey)

rubenmarin

Hi nMohammed, you can  try with:

=Count(DISTINCT {<MachDateKey{"=Max(design_accept)=3  and Min(design_accept)=3"}>} MachDateKey)

Anonymous
Not applicable
Author

Thank you all for the help...

Anonymous
Not applicable
Author

What changes do i need to write in the above set analysis expressions if I bring in one more field called "Date" which has only two unique values ?

Assume max date and min date.

sunny_talwar

Not sure I understand, what do you mean 2 unique values for the Date field? Can you elaborate with an example?