Max at one level and sum at another

I want to have the max of a value at a level and then sum at levels above,
I’m using the following:
sumover(max(planned_units),
[{reporting_date},{station_code},{country_code},{process_id},{year-week}])

However the result I’m getting is a sum at all levels instead of having a max at the first and then a sum

I also checked, if I replace the max with min or sum I get the same value

I think you need to take the maxOver before you take sumOver.

sumOver(maxOver(max({planned_units}),[{reporting_date},{station_code},{country_code},{process_id},{year-week}]),[{reporting_date},{station_code},{country_code},{process_id},{year-week}])

Let me know if that works

Hi, @Carl_Chahine. We hope that Max’s solution worked for you. I am marking his reply as, “Solution,” but let us know if this is not resolved. Thanks!