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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How do i write a condition in expression in pivot table

I would like to write a condition where, I want to write if there is a value in dimension then count/include in that count expression.

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

count({<MyDimension1={'A'}>} MyDimension1)

Note, if MyDimension1 is a key field that's linking two or more tables then use another non-key field to count:

count({<MyDimension1={'A'}>} MyDimension2_NotAKey)


talk is cheap, supply exceeds demand
javier_florian
Creator III
Creator III

Hi Surender,

Yes, you can create an expression like this:

=Count(Distinct ID)/If(Flag1='Yes',2,1)

Or something more complex like that:

=(Count({<Flag1={"Triple"}, Año={$(vMaxAño)}, Mes={"<=$(=Num(Max(Mes)))"}>} Distinct ID)/3)

+(Count({<Flag1={"Si"}, Año={$(vMaxAño)}, Mes={"<=$(=Num(Max(Mes)))"}>} Distinct ID)/2)

+(Count({<Flag1={"No"}, Año={$(vMaxAño)}, Mes={"<=$(=Num(Max(Mes)))"}>} Distinct ID))

-JFlorian

Anonymous
Not applicable
Author

Thank you, it worked.