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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mateo_florence
Partner - Contributor
Partner - Contributor

Calculating aggregates KPIs

Hello!

 

I have this expression to calculate a KPI:

=sum( aggr( FirstSortedValue( Amount, -Date ), [ID ATM] ) )

This expression sum the Amount of the max date of each ATM.  But now I have to differentiate between the ATM states (Field name: STATE_ATM).

 

I put an example to make it easy:

With my expression I get this KPI: 30.000 € (Total Amount)

Now I need to differentiate between 'Active' and ' Inactive':

    - STATE_ATM='Active' -> 20.000 €

    STATE_ATM='Inactive' -> 10.000 €

 

Any suggestion to get my KPIs??

 

Thanks!!

 

Labels (3)
1 Solution

Accepted Solutions
dwforest
Specialist II
Specialist II

=sum( aggr( FirstSortedValue({$<STATE_ATM={'Active'}>} Amount, -Date ), [ID ATM] ) )

View solution in original post

1 Reply
dwforest
Specialist II
Specialist II

=sum( aggr( FirstSortedValue({$<STATE_ATM={'Active'}>} Amount, -Date ), [ID ATM] ) )