Forum Discussion
How do I add average, min and max columns to matrix?
- 6 years ago
Hi, cmckinney
There is no direct way to achieve it. As a workaround, you may try the following steps. I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may go to 'Query Editor', make 'Name' column selected, click 'Transform'=>'Unpivot Columns'=>'Unpivot Other Columns', 'Close and Apply'.
Then you need to create measures as below.
Max = IF( NOT(ISINSCOPE('Table'[Date])), CALCULATE( MAX('Table'[Value]), ALLEXCEPT('Table','Table'[Name]) ) ) Min = IF( NOT(ISINSCOPE('Table'[Date])), CALCULATE( MIN('Table'[Value]), ALLEXCEPT('Table','Table'[Name]) ) ) Avg = IF( NOT(ISINSCOPE('Table'[Date])), CALCULATE( AVERAGE('Table'[Value]), ALLEXCEPT('Table','Table'[Name]) ) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 6 years ago
Hi, cmckinney
There is no direct way to achieve it. As a workaround, you may try the following steps. I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may go to 'Query Editor', make 'Name' column selected, click 'Transform'=>'Unpivot Columns'=>'Unpivot Other Columns', 'Close and Apply'.
Then you need to create measures as below.
Max =
IF(
NOT(ISINSCOPE('Table'[Date])),
CALCULATE(
MAX('Table'[Value]),
ALLEXCEPT('Table','Table'[Name])
)
)
Min =
IF(
NOT(ISINSCOPE('Table'[Date])),
CALCULATE(
MIN('Table'[Value]),
ALLEXCEPT('Table','Table'[Name])
)
)
Avg =
IF(
NOT(ISINSCOPE('Table'[Date])),
CALCULATE(
AVERAGE('Table'[Value]),
ALLEXCEPT('Table','Table'[Name])
)
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Awesome! Thank you so much, this is a great solution. Is there anyway to remove the min, max, and average columns under each date and just have them as a total column at the end?
- v-alq-msft6 years ago
Community Support
Hi, cmckinney
Unfortunately, it is unavailable to remove the min, max, and average columns under each date. The workaround is an alternative to achieve your requirement.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- mwegener6 years ago
Most Valuable Professional