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: 
olramirez
Contributor III
Contributor III

Aggregation with sum and max?

Hello,

i have a report with a variable for expression but the final total is wrong.

Send my report, the final total should be 170,633,792 but this is 2,265,797,212 !!

Please help me.

Olga

1 Solution

Accepted Solutions
sunny_talwar

Change your variable to this

Sum(Aggr(IF(Max({$<Año=, Mes=, MonthYear={'$(=max(MonthYear))'}>}Precio)=0,

        sum(Aggr(Max({$<Año=, Mes=, MonthYear={'$(=max(MonthYear))'}>}Valor),IdFolio)),

        Sum({$<Año=, Mes=, MonthYear={'$(=max(MonthYear))'}>}Valor)

      ), Centro, IdFolio, %FECHA, %ID_ARTICULO))

View solution in original post

2 Replies
sunny_talwar

Change your variable to this

Sum(Aggr(IF(Max({$<Año=, Mes=, MonthYear={'$(=max(MonthYear))'}>}Precio)=0,

        sum(Aggr(Max({$<Año=, Mes=, MonthYear={'$(=max(MonthYear))'}>}Valor),IdFolio)),

        Sum({$<Año=, Mes=, MonthYear={'$(=max(MonthYear))'}>}Valor)

      ), Centro, IdFolio, %FECHA, %ID_ARTICULO))

olramirez
Contributor III
Contributor III
Author

Thanks Sunny