Forum Discussion
Dealing with Matrix visualization
- 2 years ago
This issue can occur when Power BI performs automatic summarization on the matrix visual. When you collapse the rows, Power BI recalculates the totals, which can lead to incorrect results12.
To achieve your expected output, you can create a measure that checks if the row is a total row and then returns the appropriate value12. Here’s an example of how you might write this measure:
Sales Measure = IF( MAX(Table1[Istotal]) = 1, CALCULATE( SUM(Table1[Sales]), FILTER( ALL(Table1), Table1[Manager] = MAX(Table1[Manager]) && Table1[Istotal] = 1 ) ), SUM(Table1[Sales]) ) % Measure = IF( MAX(Table1[Istotal]) = 1, CALCULATE( AVERAGE(Table1[%]), FILTER( ALL(Table1), Table1[Manager] = MAX(Table1[Manager]) && Table1[Istotal] = 1 ) ), AVERAGE(Table1[%]) )In these measures, Table1 is the name of your table. These measures check if the current row is a total row (Istotal = 1). If it is, they calculate the sum or average across all total rows for the current manager. If it’s not a total row, they simply return the sales or % value for the current row12.
Please replace Table1 with your actual table name. If you need further assistance or have more specific requirements, feel free to ask! 😊
Read about ISINSCOPE and then adjust your measure accordingly.