'Hide Blank Columns in a Matrix Visualization or Show Measure Only for Total

I am relatively new to Power BI and have been asked to make some enhancements to an existing report

The report is a listing of users with the corresponding number of assets in a particular status. The enhancement I have been asked to make and having trouble with is adding a column that shows a calculated percentage.

I have attempted to create a custom measure, but when I do so, it adds the measure next to each column. I only want the measure to display after the total and have not been able to figure out how to do this.

Below is a simplified version of the report, where the calculation is just (status2+ Status3)/Total

Current Visualization

Visualization with Measure My Attempt

Desired Result

Desired Result



Solution 1:[1]

Unfortunately, I'm pretty sure there isn't an elegant way to do this at this time.

The only workarounds I can think of are terrible options involving creating multiple visuals, creating a measure per column, or hard coding column headers.


Here are some related ideas you can vote and comment on to add your support to encourage Microsoft to fix this limitation:

Hide/Show Column on Table

Show/Hide columns in report based on expression.

Power BI hide/show column

Solution 2:[2]

Perhaps I am missing something, this can be handled in PowerBI without building any measures.

I assume you are starting with a data table like this:

User    Status1 Status2 Status3
User1   2       3       4
User2   1       2       1
User3   2       3       1

Then use the Power Query Editor to add columns enter image description here

I created a Total columns with the formula:

 = Table.AddColumn(#"Changed Type", "Addition", each [Status1] + [Status2] + [Status3], Int64.Type)'

Then a column for Status2 + Status3:

 = Table.AddColumn(#"Renamed Columns", "Addition", each [Status2] + [Status3], Int64.Type)

Then the Calculation:

 = Table.AddColumn(#"Inserted Addition1", "Division", each [Addition] / [Total], type number)

With some renaming of columns, the result:

User    Status1 Status2 Status3 Total   Status2+Status3 Calculation
User1   2       3       4       9       7               0.777777778
User2   1       2       1       4       3               0.75
User3   2       3       1       6       4               0.666666667

Finally, a simple table visualization:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexis Olson
Solution 2