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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
QlikSensor
Partner - Creator
Partner - Creator

Count a field dependent on a measure

Hi,

I want to count a dimension only if a measure has a certain condition. Then I want to build a KPI.

Let's say our dimension is called Dim, and our measure is built on another Dimension Dim2.

I want to design a KPI like this:

count( {setEpression} distinct Dim) / count (distinct Dim)

Example Table:

Dim    Dim2

Val1   M1

Val1   M1

Val2  M1

Val2  M2

Val3 M1

 

The setExpression shall take only Dim values into account, if there are more than one M1 values on Dim2. In the table example above I would expect my KPI to evaluate to 1 / 3

I have no clue, how the setExpression has to look like.

1 Solution

Accepted Solutions
Taoufiq_Zarra

@QlikSensor  Maye be :

=count({<Dim={"= count({<Dim2={'M1'}>}Dim2)>1"}>}  distinct Dim)/count (distinct Dim)

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

@QlikSensor  Maye be :

=count({<Dim={"= count({<Dim2={'M1'}>}Dim2)>1"}>}  distinct Dim)/count (distinct Dim)

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
QlikSensor
Partner - Creator
Partner - Creator
Author

Wow, thanks. Never would get that running without your help.