Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
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))