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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Nankaina
Helper I
Helper I

Matrix Row Totals within Row Values

I'm recreating a matrix from Excel into Power BI, and attempting to match the formatting as much as possible. There's a fairly simple matrix in it, with values something like this:

Nankaina_0-1775665863787.png

I would like to display these values as a fraction of the row total, updating with new data as it comes in. ie:

Nankaina_2-1775665943847.png

I've managed to get the inverse, where it shows the values as a fraction of the column total, by using the following DAX:

Table Output = COUNT('Sample Data'[X-values]) & "/" & CALCULATE(COUNTA('Sample Data'[X-values]), ALLSELECTED('Sample Data'[Y-values]))

Leading to this close, but incorrect, table: 

Nankaina_1-1775665920422.png

But when I swap X-values and Y-values in the CALCULATE, I don't get the desired row totals; I get each value just divided by itself (10/10, 9/9, 22/22, etc.)

 

How can I get these to display with the sum of the row as their denominator, instead of the sum of the column?

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Nankaina add following two measures:, and use display measure in the matrix visual

 

Sum Measure = SUM ( YourTable[YourColumn] )

Display Measure = 
FORMAT ( [Sum Measure], "#" ) & "/" &
FORMAT ( CALCULATE ( [Sum Measure], ALLSELECTED ( YourTable[X-ValueColumn] ) ), "#" )

 

parry2k_0-1775673343302.png

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
pcoley
Continued Contributor
Continued Contributor

As @Nankaina just answered, you should adjust the meassure called Table Output taking into account all the [X-values] and not the [Y-values] in the ALLSELECTED formula.
ALLSELECTED('Sample Data'[X-values])

Table Output CORRECT= COUNT('Sample Data'[X-values]) & "/" & CALCULATE(COUNTA('Sample Data'[X-values]), ALLSELECTED('Sample Data'[X-values])

## Actual Meassure (wrong):
## Table Output = COUNT('Sample Data'[X-values]) & "/" & CALCULATE(COUNTA('Sample Data'[X-values]), ALLSELECTED('Sample Data'[Y-values])

 

Regards, PColey 
I hope this helps.
Please Mark my post as a solution if it helped to resolve your issue.
Kudos are Welcome!
Please do let us know if you have any further queries.
parry2k
Super User
Super User

@Nankaina add following two measures:, and use display measure in the matrix visual

 

Sum Measure = SUM ( YourTable[YourColumn] )

Display Measure = 
FORMAT ( [Sum Measure], "#" ) & "/" &
FORMAT ( CALCULATE ( [Sum Measure], ALLSELECTED ( YourTable[X-ValueColumn] ) ), "#" )

 

parry2k_0-1775673343302.png

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

Users online (3,602)