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
dokat
Post Prodigy
Post Prodigy

Create Dynamic Matrix Table

Hi,

 

I have a matrix table like below in my power bi dashboard. I created the table by bringing P&L lines and values from Field Pane. The table is static it only pulls YTD 2022 vs 2021. However i have 3 time periods in my report, last year, latest 4 weeks and year to date. Tricky part is all the 4 out of 5  P&L lines are coming from the data table however "Spend" is calculation and not part of original data table. and i need rows to be in the same order below. How can make this table dynamic so that when i change the slicer data gets updated  with selected period ? Appreciate anyones help.!

 

 20212022
Sales$100$110
COGS$50$55
Spend$10$11
Profit$40$44
Contrbution$30$33
1 ACCEPTED SOLUTION
dokat
Post Prodigy
Post Prodigy

I found solution to my problem following @Stachu  directions in below link. 

 

Solved: Create calculated row - Microsoft Power BI Community

View solution in original post

5 REPLIES 5
dokat
Post Prodigy
Post Prodigy

I found solution to my problem following @Stachu  directions in below link. 

 

Solved: Create calculated row - Microsoft Power BI Community

Greg_Deckler
Super User
Super User

@dokat If I am following this correctly, many people solve this by using a disconnected table in a slicer and a measure that returns the desired measure based upon what is chosen in the slicer. So, use SELECTEDVALUE to grab the value of the slicer and then a SWITCH statement to return the correct measure.

 

Otherwise, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thank you for your response. The data is in below format, only difference is row "spend" is not included and it is a calculated measure. Everything else is coming from P&L table. I would like create a dynamic matrix table like below and updated it based on slicer period selection. Hope this helps clarify. My report has confidential information because of that difficult to share. Thanks

Slicer Option: YTD, Last 4 weeks, and Last Year. 

 

 20212022
Sales$100$110
COGS$50$55
Spend$10$11
Profit$40$44
Contrbution$30$33

 

@dokat Really need mock data that emulates your real data. And your measure formula. So is your source data like:

Category Date Amount
Sales 1/1/2022 $10
Sales 1/2/2022 $20
Spend 1/1/2022 $5
Spend 1/2/2022 $5

 



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler below you will find the link to the sample data file. I included year ende 2021 and 2020 and latest 4 weeks data.

 

Calculation for "Spend" is Sales - Trade. All other PL lines comes from the data table. Thanks

 

https://www.dropbox.com/s/87dz0f9ibx30l3h/Sample%20Data.pbix?dl=0

 

 20212022
Sales  
COGS  
Spend  
Profit  
Contrbution  

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.