Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SUM IF MAX

Hi,

trying to show the end balance. Using the below does not work,

SUM(IF(SettlementOrder=(MAX( SettlementOrder)),Balance))

If I add the "TOTAL" it works, but I need this figure for each date.

SUM(IF(SettlementOrder=(MAX(TOTAL SettlementOrder)),Balance))

TOTAL gives me one single value (based on largest historical SettlementOrder-number)

Any clues?

Kind REgards,

Olle

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expression

=SUM(Aggr(IF(SettlementOrder= (MAX(TOTAL <Date> SettlementOrder)), Sum(Balance)), Date, SettlementOrder))

Regards,

Jagan.

View solution in original post

15 Replies
MK_QSL
MVP
MVP

Can you please provide sample data?

gmoraleswit
Partner - Creator II
Partner - Creator II

Maybe:

SUM(IF(SettlementOrder=(MAX(TOTAL<Date> SettlementOrder)),Balance))


Can you provide more data, an example or screenshot? are you using this expression in a chart? what are your dimensions?



Not applicable
Author

Hi,

SUM(IF(SettlementOrder=firstsortedvalue(TOTAL SettlementOrder,-SettlementOrder)),Balance))

Hope this helps

Not applicable
Author

or try removing total also if that doesn't work

Not applicable
Author

Put the 'if' outside of 'Sum'. Like IF(SettlementOrder=MAX( SettlementOrder),Sum(Balance))

Not applicable
Author

Hi Gabriela,

not working Im afraid. And non of the below suggestions either.

But here comes a sample file!

Thanks in advance,

Olle

tresesco
MVP
MVP

=Sum(IF(SettlementOrder=($(=MAX( SettlementOrder))),Balance)) 

PFA

Not applicable
Author

Hi tresesco,

still just giving me the one balance (from the date with the largest amount of transactions). I need to show the end balance for each date.

Kind Regards,

Olle

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expression

=SUM(Aggr(IF(SettlementOrder= (MAX(TOTAL <Date> SettlementOrder)), Sum(Balance)), Date, SettlementOrder))

Regards,

Jagan.