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

How to remplace aggr(max()) ?

Hello everyone, I have the folowing table (example.)

YearMonthNumTktPaymentMethodAmount
2016091Money25
2016091Cart25
2016092Money30
2016093Cart45
20160812Money20
20160813Cart32

I'll like the sum amount for the year 2016, the month of September by ticket.

The first exepression I used is

==> sum (if (year = 2016 and month = 09, Amount))

The problem is that it returns me 50$ for Ticket 1. I want 25. So I used the following expression

==> sum (if (year = 2016 and month = 09, aggr (max (Amount), NumTkt)))

But the application become very slow, you have another solution?

5 Replies
Gysbert_Wassenaar

Try max(total <Year, Month, NumTkt> Amount). Or just remove the NumTkt dimension and use max(Amount) as expression.


talk is cheap, supply exceeds demand
miguelbraga
Partner - Specialist III
Partner - Specialist III

Is this what you want?

Best regards,

D.A. MB

Not applicable
Author

thx for you reply,

but No , iI want 100 as result ( 25 + 30 + 45) and no 125 ( 25+25+30+45)

Year-Month2016-09
Amount100
Not applicable
Author

sum(if(Year=2016 and Month=9 ,max(total <Year, Month, NumTkt> Amount))) return me nothin , the expression is good ?

Gysbert_Wassenaar

No, try max(total <Year, Month, NumTkt> Amount) instead of nesting it in a sum.


talk is cheap, supply exceeds demand