Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
trg7ija
New Member

Display percentage instead of total in matrix visual

Hi, I am new to Power BI.

I use matrix visual but the subtotal display the total of the column.

Like this visual

1.png

 

But I expect to be like this

2.png

 

So the percent will calculate to total of each column dan calculate the percetage based on total number of Names.

 

Thank you very much in advance

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @trg7ija ,

 

To achieve the desired percentage display in your Power BI matrix, you first need to reshape your data and then create a specific calculation. The core idea is to transform your data from a wide format, where each question is its own column, into a tall format that is more suitable for analysis. You can accomplish this within the Power Query Editor by selecting the "NAME" column, navigating to the "Transform" tab, and choosing to "Unpivot Other Columns." This action will create two new columns, which you should rename for clarity to "Question" (formerly "Attribute") and "Value". After applying these changes, you will return to the main Power BI window.

 

With the data correctly structured, the next step is to create a DAX (Data Analysis Expressions) measure to calculate the percentage. Right-click on your table in the Data pane, select "New measure," and then enter the following formula. This code calculates the percentage by dividing the sum of correct answers (the '1's) for each question by the total number of respondents in your dataset.

Percentage Score =
VAR SumOfOnes =
    SUM ( 'YourTableName'[Value] )
VAR TotalNames =
    CALCULATE (
        DISTINCTCOUNT ( 'YourTableName'[NAME] ),
        ALL ( 'YourTableName'[NAME] )
    )
RETURN
    DIVIDE ( SumOfOnes, TotalNames )

Remember to replace 'YourTableName' with the actual name of your data table. Once the measure is created, select it in the Data pane, go to the "Measure tools" tab in the ribbon, and click the '%' icon to format it as a percentage. Finally, to build your visual, drag the "NAME" field to the Rows area, the "Question" field to the Columns area, and your newly created [Percentage Score] measure into the Values area of the matrix visual. This will replace the simple count totals with the calculated percentages for each column total row as you intended.

 

Best regards,

View solution in original post

2 REPLIES 2
DataNinja777
Super User
Super User

Hi @trg7ija ,

 

To achieve the desired percentage display in your Power BI matrix, you first need to reshape your data and then create a specific calculation. The core idea is to transform your data from a wide format, where each question is its own column, into a tall format that is more suitable for analysis. You can accomplish this within the Power Query Editor by selecting the "NAME" column, navigating to the "Transform" tab, and choosing to "Unpivot Other Columns." This action will create two new columns, which you should rename for clarity to "Question" (formerly "Attribute") and "Value". After applying these changes, you will return to the main Power BI window.

 

With the data correctly structured, the next step is to create a DAX (Data Analysis Expressions) measure to calculate the percentage. Right-click on your table in the Data pane, select "New measure," and then enter the following formula. This code calculates the percentage by dividing the sum of correct answers (the '1's) for each question by the total number of respondents in your dataset.

Percentage Score =
VAR SumOfOnes =
    SUM ( 'YourTableName'[Value] )
VAR TotalNames =
    CALCULATE (
        DISTINCTCOUNT ( 'YourTableName'[NAME] ),
        ALL ( 'YourTableName'[NAME] )
    )
RETURN
    DIVIDE ( SumOfOnes, TotalNames )

Remember to replace 'YourTableName' with the actual name of your data table. Once the measure is created, select it in the Data pane, go to the "Measure tools" tab in the ribbon, and click the '%' icon to format it as a percentage. Finally, to build your visual, drag the "NAME" field to the Rows area, the "Question" field to the Columns area, and your newly created [Percentage Score] measure into the Values area of the matrix visual. This will replace the simple count totals with the calculated percentages for each column total row as you intended.

 

Best regards,

@DataNinja777 

Thank you very much sir.

It works!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Users online (25,968)