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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
mmandich
New Member

Get percent of row subtotal in a matrix with two rows & one column

I am trying to create a matrix where the values are the % of row subtotals. I have two rows & one column. I'm a beginner in power BI & have been trying to get this right for hours...
This is what I would like my data to look like:
 
              Columns
Row1     Row 2      Risk 1   Risk 2   Risk 3
Asset 1   A              10%      40%      5%
Asset 1   B               20%     30%      60%
Asset 1   C               50%     20%      35%   --->total sums to 100% for each asset 
Asset 2   A        
Asset 2   B
Asset 2   C
Asset 3   A
Asset 3   B
Asset 3   C
 
I've looked at other solutions on this page and tried many variations of the following measure for my matrix values:
 
Measure =
var var1=Calculate(SUM('Table'[Values]),ALL('Table'[Row2]))
var var2=SUM('Table'[Values])
return divide(var2,var1)
 
However this just returns 100% for every cell. It's like the All() function isn't working. 
 
My data looks like this:
Row 1     Column 1   Row 2    Value
Asset 1    Risk 1         A            100
Asset 1    Risk 2         B             100
Asset 1    Risk 3         B             100 
Asset 1    Risk 4         C             100
 
There is one row 2 category for each row1/column1 combination and one value for each row1. I'm only pulling data from the one table
2 REPLIES 2
vicky_
Super User
Super User

You can achieve that result without writing a new measure - assuming that all the risks are coming from a single measure, try to right click on your measure and select "percent of row total"

vicky__0-1705614235459.png

 

Tried that and got some odd values - less than 100% for each asset.

mmandich_0-1705614761967.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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