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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to add a row to calculate percentage in a matrix?

Hi, here is a question how to create a measure on row level in matrix.

for example, the last row is the result of a division, which 'competitive' is numerator and the row 'total' is denominator, do you have any good ideas?

Thank you.微信图片_20220215185738.png

 

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1645173761033.png

You can achieve this using create new table

Here are the steps you can follow:

1. Create calculated table.

Row_SubTotal =
var _summarize=SUMMARIZE(
    'Row_Table',[Date],
    "Name","Sum",
    "Value",SUM(Row_Table[Value]))
return
UNION('Row_Table',_summarize)

vyangliumsft_1-1645173761036.png

Summarize_Table =
var _summarize=SUMMARIZE(
    'Row_SubTotal',[Date],
    "Name","Total",
    "Value", 
   FORMAT( DIVIDE(SUM('Row_SubTotal'[Value])/2,SUM('Row_Table'[Value])),"Percent"))
return
UNION('Row_SubTotal',_summarize)

vyangliumsft_2-1645173761038.png

2. Result:

There are two things to note here:

1. You can replace "Competitve" with ''Sum', because Power BI sorts alphabetically by default. In my data, it is ABCDE. If it is written as "Sum", it will be in alphabetical order S>E&&S<T , placed after E and before Total.

2. Because the data format of a column must be the same, if one value is Whole number and the other is Percent, there will be a data type error, so I convert it to Text.

vyangliumsft_3-1645173761041.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

Thank you. It's seems splendid, it's a good idea when data columns like that.

My biggest problem is the data is not in that form and the data should be shown originally, filtered by slicer, and add a row to calculate the percent based on certain other rows. So use a matrix to transpose is not meet the needs.

1.png

for example, show those data in a table and 4 slicers: region, org3.2, org4.2, org5, and add a row to calculate evary value column, the numerator  is the number when dim_2 is  'competitive' is and denominator is the number when dim_2 is 'firm' (total active%=160/217, fufilled%=65/35)

Is there to be a solution that add a row like that in this table, or add in new table with the result of calculation below the details table that remain the same slicers and same column name? Thank you.

amitchandak
Super User
Super User

@Anonymous , you can not add a row, You can change total using isinscope or hasonevalue to % total

 

https://xxlbi.com/blog/new-dax-function-isinscope/

https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

 

Or you use this excel/power bi merge approach by Curbal

https://www.youtube.com/watch?v=IISYzTaIyu4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.