Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone, I have the folowing table (example.)
Year | Month | NumTkt | PaymentMethod | Amount |
---|---|---|---|---|
2016 | 09 | 1 | Money | 25 |
2016 | 09 | 1 | Cart | 25 |
2016 | 09 | 2 | Money | 30 |
2016 | 09 | 3 | Cart | 45 |
2016 | 08 | 12 | Money | 20 |
2016 | 08 | 13 | Cart | 32 |
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?
Try max(total <Year, Month, NumTkt> Amount). Or just remove the NumTkt dimension and use max(Amount) as expression.
Is this what you want?
Best regards,
D.A. MB
thx for you reply,
but No , iI want 100 as result ( 25 + 30 + 45) and no 125 ( 25+25+30+45)
Year-Month | 2016-09 |
---|---|
Amount | 100 |
sum(if(Year=2016 and Month=9 ,max(total <Year, Month, NumTkt> Amount))) return me nothin , the expression is good ?
No, try max(total <Year, Month, NumTkt> Amount) instead of nesting it in a sum.