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

Calculating percentage

Hi

I am using the below formula for calculating the percentage in a bar chart ,

Count(distinct(Col1)) / Count(Total<DIM1>distinct Col1)

i need to include an if condition in the above expression to get just ACTIVE Col 1 values

somthing like Count(if(Col2 ='ACTIVE', distinct(Col1) / Count(If(Col2 = 'ACTIVE',.total<.... but not sure how to include this in the total ...

Can someone please help ?

Thanks

1 Reply
swuehl
MVP
MVP

You can try a set expression:

Count({<Col2 = {ACTIVE}>} distinct(Col1)) / Count({<Col2 = {ACTIVE}>} Total<DIM1>distinct Col1)


or with an if():


Count(distinct if(Col2='ACTIVE',Col1)) / Count(Total<DIM1> distinct if(Col2='ACTIVE',Col1))