Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
AdithyaVarma8
Contributor II
Contributor II

If condition with Aggr in KPI

How to get the below expression in KPI

If(sum( Aggr (CustomerId, Dispense)) = 0, Count(Distinct CustomerId),0). 

The same expression works fine in the table below.  Ideally the result of KPI should be 6 as per the below  highlighted scenario.

 

=Aggr(SUM(Dispense), CustomerId)sum( Total <CustomerName,CustomerId> Dispense)If(sum( Aggr (CustomerId, Dispense)) = 0, Count(Distinct CustomerId),0)=If(Aggr(SUM(Dispense), CustomerId)=0,CustomerId)=Aggr(SUM(Dispense), CustomerId)
00.0E+0001120
00.0E+0001130
00.0E+0001140
00.0E+0001150
00.0E+0001160
00.0E+0001170
Labels (3)
1 Solution

Accepted Solutions
Channa
Specialist III
Specialist III

Count(Distinct {<CustomerId={"=Aggr(SUM(Dispense), CustomerId)>0"}>} CustomerId)

Channa

View solution in original post

3 Replies
Lisa_P
Employee
Employee

Try using set analysis for your KPI:

Count({<Dispense={">0"}>}Distinct CustomerId)

Channa
Specialist III
Specialist III

Count(Distinct {<CustomerId={"=Aggr(SUM(Dispense), CustomerId)>0"}>} CustomerId)

Channa
AdithyaVarma8
Contributor II
Contributor II
Author

@Channa  Thank you.