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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count with a condition

Hello,

in the "expression" tab of a pivot table, I'd like to make a count only if a condition is true, like this:

CONDITION: [QUOTA PARTECIPAZIONE DIRETTA]>'0,0' and [QUOTA PARTECIPAZIONE DIRETTA]<='0,1'

EXPRESSION: count(DISTINCT [CODICE ISTAT ENTE PARTECIPANTE])

Where I go wrong?

Thanks.

Lorenzo

1 Solution

Accepted Solutions
maxgro
MVP
MVP

condition on expression?

count(distinct if([QUOTA PARTECIPAZIONE DIRETTA]>0,  [CODICE ISTAT ENTE PARTECIPANTE]))

remove single quote

remove decimal or if you want it, I suppose you have to use .  not  , (comma)

View solution in original post

5 Replies
richard_pearce6
Partner - Specialist
Partner - Specialist

Add a field into your table:

1 as RowCount

Then you can use set analysis:

sum({<[QUOTA PARTECIPAZIONE DIRETTA]={">0"}>}      RowCount)

Regards

Richard

Not applicable
Author

Hi there,

Please check out the attached file. Its a slight variation to Richard's solution. I am using an If condition on the back-end to determine if its >0 (a Flag) so that on the front end you can just do Sum(Flag).

Hope it helps

Thanks

AJ

maxgro
MVP
MVP

condition on expression?

count(distinct if([QUOTA PARTECIPAZIONE DIRETTA]>0,  [CODICE ISTAT ENTE PARTECIPANTE]))

remove single quote

remove decimal or if you want it, I suppose you have to use .  not  , (comma)

its_anandrjs
Champion III
Champion III

In Load script add a flag like

Load

If([QUOTA PARTECIPAZIONE DIRETTA] <= 0 ,1) as QPD_Flag

From Location;

And then in expression use expression

Count(QPD_Flag)

Not applicable
Author

Thanks to all for your support