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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ryan_b_fiting
Post Patron
Post Patron

Calculated Measures as Rows and Columns in Matrix

Hello Community - 

 

I am looking for some help with presenting Multiple Measures within a matrix visual.  I have the following measures:

Sales = SUMX(Orders, Dollars_Sale)

COGS = SUMX(Orders, Order_cost)

$ Margin = Sales - COGS

 

I then have branched off of those measure to calculate my MTD, QTD, YTD measures.  What I am looking to do is create a matrix visual that will show my 3 measures (Sales, COGS, $ Magin) as rows, and then values be the MTD, QTD, YTD measures.

 

I know that you are able to switch the values to rows, but I do not want my To Date measures to show as rows, I want those to be the columns in the matrix.

 

Is there a way to create this type of Measure?  Below is what I would want the output to look like:

 

MeasureMTDQTDYTD
Sales100016502900
COGS60011002275
$ Margin400550625

 

Thank you in advance for any advice and input!

Ryan

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@ryan_b_fiting 

Take a look at the Calculation Groups functionality.  I belive it will accomlish what you are looking for.  Here are some videos discussing the topic and showing how to create them:
https://www.youtube.com/watch?v=vlnx7QUVYME&ab_channel=GuyinaCube

https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/

 

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

@ryan_b_fiting 

Take a look at the Calculation Groups functionality.  I belive it will accomlish what you are looking for.  Here are some videos discussing the topic and showing how to create them:
https://www.youtube.com/watch?v=vlnx7QUVYME&ab_channel=GuyinaCube

https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/

 

@jdbuchanan71  this works great.  But I am having one issue with it.  When I want to look at MTD LY my calculation group does not calculate that properly.  I seem to always get 1 of 2 outputs.  It either gives me the Current MTD instead of LY.  Or it will give me LY but for the entire month,.

 

Here is the measure I am using in my Calculation group to try to get MTD LY for a partial month, but this gives me just Current MTD

VAR _MTD = TOTALMTD( SELECTEDMEASURE(), Rolling_Calendar[Date] ) RETURN  CALCULATE( _MTD, SAMEPERIODLASTYEAR(Rolling_Calendar[Date] ) )

 

Is there a way to calculate the parital MTD LY within calculation groups?  I want to be able to see my Sales for October 2019 but only through October 19th.

 

Thanks for all the insight! 

There are some tricks you can use to stop future dates from coming into PY calculations.  Take a look at this article that goes through the steps of how to handle them.
https://www.sqlbi.com/articles/hiding-future-dates-for-calculations-in-dax/

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors