Forum Discussion
Matrix row hiding
Create a New Measure for Percentage Calculation: Create a measure that calculates the percentage based on the total, excluding the "Other" category.
PercentageWithoutOther =
VAR TotalWithoutOther =
CALCULATE(
SUM(Sales[SalesAmount]),
ALL(Sales[Category]),
Sales[Category] <> "Other"
)
RETURN
DIVIDE(
SUM(Sales[SalesAmount]),
TotalWithoutOther,
0
)
This measure calculates the percentage of each category, excluding the "Other" category from the total calculation.
Filter the Matrix Visual: Use this measure in the matrix visual. Instead of filtering out the "Other" row, let the visual naturally exclude it by only displaying rows where the Category is not "Other".
- Drag your original category field into the Rows area of the matrix.
- Apply a visual-level filter on this field to exclude "Other".
Modify the Measure to Display Empty for 'Other': Modify the PercentageWithoutOther measure to return a blank value for the "Other" category.
PercentageWithoutOther =
IF(
SELECTEDVALUE(Sales[Category]) = "Other",
BLANK(),
VAR TotalWithoutOther =
CALCULATE(
SUM(Sales[SalesAmount]),
ALL(Sales[Category]),
Sales[Category] <> "Other"
)
RETURN
DIVIDE(
SUM(Sales[SalesAmount]),
TotalWithoutOther,
0
)
)
Hide Blank Rows: In the matrix visual, go to the Format pane, find the Row Headers section, and enable the Show items with no data toggle. This will hide the "Other" row, as it will now be blank.