Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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

Tags (2)
1 Solution

Accepted Solutions
MVP
MVP

Re: count with a condition

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)

5 Replies
richard_pearce6
Valued Contributor

Re: count with a condition

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

Re: count with a condition

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

MVP
MVP

Re: count with a condition

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)

Re: count with a condition

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

Re: count with a condition

Thanks to all for your support

Community Browser