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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
StevenHiatt
Frequent Visitor

How to Dynamically Change the Field in Matrix Rows Based on a Slicer?

I know it is possible to create a DAX formula that will dynamically change the calculated metric that shows in the values part of a matrix, but I'm wondering if it is possible to change the field that shows up in the rows?

 

As an example, I have a simple set of sales data (from the Adventure Works DB) that includes Date, Customer, Product, and Sales Amount. I would like to have a matrix that would show the total Sales Amount, but be able to change whether the rows are Customer or Product based on a slicer.

 

Desired output:

If Customer is selected in slicer - Customer shows in Rows

StevenHiatt_0-1627589811697.png

If Product is selected in slicer - Product shows in Rows

StevenHiatt_1-1627589873743.png

 

In my full data I have a number of metrics that I would like to be able to show for different groups (Business Unit, Sales Person, Customer, Product, Etc.). I know you can add them all in the rows field and drill down, but sometimes you want a different field to be on top. I'm trying to find the best way to show the same matrix for multiple categories without having multiple tabs. Is this possible or just wishful thinking?

 

For the screenshots above I used some data from the AdventureWorks database. Here is a link to the pbix on Dropbox:

Dropbox file - Sales Sample.pbix 

 

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@StevenHiatt Maybe: https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-EVERYTHING-measures-axis-legend-titl...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@StevenHiatt Maybe: https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-EVERYTHING-measures-axis-legend-titl...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler That link has some good information on how to dynamically change the values and a title, but I'm not seeing how I can use that info to change the rows in a matrix. Any other help?

@StevenHiatt It *should* be the same concept as changing the Axis in the column chart. Basically, you are going to need a table that has all of your customers and products in a column with your categorization (slicer) in another column in the same table. Then, when you select the item in the slicer, only the rows (either product or customers) is shown in the rows of the matrix.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thanks. I looked a bit deeper at the example in the link and was able to understand the concept. I've now added a new table with the category and list of customers/products. I also added an index column to the original table and pulled that into the new table as well and added the relationship. So the rows in the matrix will now change when I select the different categories in the slicer. This is awesome!

 

The issue I have now is that all the values are giving the total of everything and not just the total of the customer/product shown.

 

StevenHiatt_1-1627665341535.png

The example file in the link has DAX formulas that return diffierent metrics based on the filter selections, but in my case it is just the one field Total Sales. I've been trying to get it work but haven't been successful yet. What am I still missing?

 

Here is a link to the pbix:

Dropbox File - Sales Sample 2.pbix 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.