Forum Discussion
Create a weekly measure for average, min, max after grouping
- 3 years ago
I found the answer to this by using MINX, MAXX, AVERAGEX and inputting the summary table in the function.
Example:
VAR summary_table = FILTER( SUMMARIZE(‘Delivery Info’, ‘Delivery Info’[Location],’Delivery Info’[Year] , ’Delivery Info’[Date], ’Delivery Info’[Week num], "sum", SUM(‘Delivery Info’[# Units]) )
VAR week_avg = AVERAGEX( summary_table, [sum] )
RETURN
week_avgAnd then for month, same process but switched out the [Week num] for the [Month #] in the summary table:
FILTER( SUMMARIZE(‘Delivery Info’, ‘Delivery Info’[Location],’Delivery Info’[Year] , ’Delivery Info’[Date], ’Delivery Info’[Month #], "sum", SUM(‘Delivery Info’[# Units]) )
I found the answer to this by using MINX, MAXX, AVERAGEX and inputting the summary table in the function.
Example:
VAR summary_table = FILTER( SUMMARIZE(‘Delivery Info’, ‘Delivery Info’[Location],’Delivery Info’[Year] , ’Delivery Info’[Date], ’Delivery Info’[Week num], "sum", SUM(‘Delivery Info’[# Units]) )
VAR week_avg = AVERAGEX( summary_table, [sum] )
RETURN
week_avg
And then for month, same process but switched out the [Week num] for the [Month #] in the summary table:
FILTER( SUMMARIZE(‘Delivery Info’, ‘Delivery Info’[Location],’Delivery Info’[Year] , ’Delivery Info’[Date], ’Delivery Info’[Month #], "sum", SUM(‘Delivery Info’[# Units]) )