Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Atrox
Partner - Contributor II
Partner - Contributor II

How to aggregate to show the maximum values based on the sum for the selected period?

Hi Qlik Community,

I am trying to write an aggregation that returns the maximum month for the selected period as follows: 
Atrox_0-1666940974950.png

in the above table, the lowest row is the sum of the upper ones. The measure that should return the maximum values for the selected period. So for example if I select Quarter 1 of 2020. It should return all the columns of the values for 1stlevel and the 2ndlevel for the month of January of Quarter 1 of 2020 since the sum gives 145 which is the highest. How can I achieve this result?

 

Attached you can find 2 tables with which you can load the above data.

Thanks in advance for any type of assistance.

Kind Regards.

Labels (6)
2 Replies
vinieme12
Champion III
Champion III

=Max(Aggr( Sum(someMeasure),Year,Month))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Atrox
Partner - Contributor II
Partner - Contributor II
Author

Hello vinieme12,

 

Thanks for the measure. However, this measure doesn't yield the correct result. I adjusted the measure to the following since I need a result for each dimension:=

Max(Aggr(Sum(Value),Year,Month,[2ndlevel]))

Nevertheless the above is also incorrect. When I try to select Q1 for example the results are the following:

Atrox_0-1666950248238.png

the issue with the above is that it returns a maximum value for each value of 1stlevel and 2ndlevel which is different from what is asked.

What it should return for the Q1 2020 is the following:

Atrox_1-1666950609038.png

 

Kind Regards.