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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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
MVP
MVP

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