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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
royalty123
Regular Visitor

Power BI Chart - Matrix Chart

Hi All,

 

Please help me creating DAX measures to showcase the below request.

 

  • From a product cost perspective, where have we increased cost year over year (and to what extent)
  • For products that we have increased selling cost, how much of the sales growth year over year has been a result of cost increases vs quantity increases?

Create a matrix chart to show the year over year comparison for above two questions

 

Here is a rough data for reference.

 

ProductDateQuantityCost
USA2025-02-2497497.67
Brazil2023-11-3025799.44
Germany2024-12-2489246.83
India2024-04-0577486.16
USA2024-11-2161973.81
USA2023-10-1552713.08
India2024-06-2899920.5
USA2025-01-1753976.46
India2025-01-0139543.27
USA2024-10-2733197.85
Japan2025-02-0919862.77
India2024-08-1174553.3
Germany2025-03-1386151.2
USA2024-06-0177235.73
Germany2024-10-2636455.37
Germany2023-10-2249250.34
Brazil2025-03-2862246.99
India2024-12-0741828.54
Brazil2025-03-0753958.89
India2023-07-2670789.49

 

Please attach the power bi file that you worked on to apply the DAX measures with my column names. Thanks a ton!

1 ACCEPTED SOLUTION
v-kpoloju-msft
Community Support
Community Support

Hi @royalty123,

Thank you for reaching out to the Microsoft fabric community forum. Thank you @lbendlin@danextian, for your inputs on this issue.

After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.


Date Table Dax:

CalendarTable = ADDCOLUMNS(
CALENDAR(MIN(Data[Date]), MAX(Data[Date])),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMM")
)

Previous Year’s Cost Measure:

Prev_Year_Cost = CALCULATE(SUM(Data[Cost]), SAMEPERIODLASTYEAR(CalendarTable[Date]))


Cost Increase YoY Measure:
Cost_Change_YoY = SUM(Data[Cost]) - [Prev_Year_Cost]


Previous Year’s Quantity Measure:
Prev_Year_Qty = CALCULATE(SUM(Data[Quantity]), SAMEPERIODLASTYEAR(CalendarTable[Date]))


Sales Growth from Cost Increase Measure:
Sales_Growth_from_Cost = [Cost_Change_YoY] * [Prev_Year_Qty]


Sales Growth from Quantity Increase Measure:

Sales_Growth_from_Qty = SUMX(Data, Data[Cost] * (Data[Quantity] - Data[Prev_Year_Qty]))



I am also including .pbix file for your better understanding, please have a look into it:


I hope this could resolve your issue, if you need any further assistance, feel free to reach out. If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

View solution in original post

7 REPLIES 7
v-kpoloju-msft
Community Support
Community Support

Hi @royalty123,

Thank you for reaching out to the Microsoft fabric community forum. Thank you @lbendlin@danextian, for your inputs on this issue.

After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.


Date Table Dax:

CalendarTable = ADDCOLUMNS(
CALENDAR(MIN(Data[Date]), MAX(Data[Date])),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMM")
)

Previous Year’s Cost Measure:

Prev_Year_Cost = CALCULATE(SUM(Data[Cost]), SAMEPERIODLASTYEAR(CalendarTable[Date]))


Cost Increase YoY Measure:
Cost_Change_YoY = SUM(Data[Cost]) - [Prev_Year_Cost]


Previous Year’s Quantity Measure:
Prev_Year_Qty = CALCULATE(SUM(Data[Quantity]), SAMEPERIODLASTYEAR(CalendarTable[Date]))


Sales Growth from Cost Increase Measure:
Sales_Growth_from_Cost = [Cost_Change_YoY] * [Prev_Year_Qty]


Sales Growth from Quantity Increase Measure:

Sales_Growth_from_Qty = SUMX(Data, Data[Cost] * (Data[Quantity] - Data[Prev_Year_Qty]))



I am also including .pbix file for your better understanding, please have a look into it:


I hope this could resolve your issue, if you need any further assistance, feel free to reach out. If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

Hi @royalty123,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

Hi @royalty123,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

 

Hi @royalty123,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.


Thank you.

lbendlin
Super User
Super User

No need for measures. You can visualize this without code.

 

lbendlin_0-1743554115656.png

 

royalty123
Regular Visitor

Hi @danextian : I don't have any power bi file. I just had an excel file. I shared the table along with my question. Thank you!

danextian
Super User
Super User

You seem to have forgotten the Power BI file. Please post the link to file stored in the cloud. Only superusers, MVPs and admins can attach files.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.