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!

Hey both,
I remember this worked when I tried it last time, but now I’m trying to do the same change but it’s not working.
So in the dataset I have that pushes to QS, i have data showing at country day level. I created a column to get the values at a country week level (max at country week) and now in the dashboard I have data at lowest granularity (day).
I want to get the max from day to week and the sum from week upwards.

I’m using this:

sumover(
maxover(abs(max({wape_num})),[{week_number},country,region,Year,{Year-Month}]),
[{week_number},country,region,Year,{Year-Month}])

but it’s doing a sum from day to week level
Any idea on how to proceed?