Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need to use if statement and Count fucntion together

Good Morning Everyone,

I need to use if statement and counte function together in my expression, but when i use the following query nothing showing in my gauge chart.

=If(Identity = 'A' , count(distinct{<Identity = {'A'}>}[ID]), If (Identity = 'B' , count(distinct{<Identity = {'B'}>}[ID]))

2 Replies
Not applicable
Author

Try putting the distinct after the set expression:

=If(Identity = 'A' , count({<Identity = {'A'}>}distinct [ID]),

If (Identity = 'B' , count({<Identity = {'B'}>}distinct[ID]))

jvitantonio
Luminary Alumni
Luminary Alumni

Don't use IF. Use directly

= count(distinct [ID])

This will count ID depending on your dimension (Identity)

If not, post your  application so I can work on it