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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Martin74
Helper I
Helper I

Compare this month with previous month in a matrix with multiple months

Hello Guys,

 

I need some help with following (i can't figure out by myself). I import some data from a SQL server, put this in a matrix where per month the maximum value is shown by month. I want to show the difference for the last month by the previous month, so only one additonal column in the matrix on the end of it.

 

DataFile: https://www.dropbox.com/s/ylxnnrpxt2vq4xu/data.csv?dl=0

BI File: https://www.dropbox.com/s/twikjwox0yq6bok/PBI%20Test.pbix?dl=0

 

 

PBI Test.jpgPBI Test 2.jpg

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

Hi @Martin74 ,

 

Please check the measure.

Measure = CALCULATE(MAX(data[ActualValue]),FILTER(ALL(data),data[UTCDateTime].[Year]=SELECTEDVALUE(data[UTCDateTime].[Year])&&data[UTCDateTime].[MonthNo]=SELECTEDVALUE(data[UTCDateTime].[MonthNo])-1&&data[PointName]=SELECTEDVALUE(data[PointName])))-MAX(data[ActualValue])

Result would be shown as below.

4.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @Martin74 ,

 

Please check the measure.

Measure = CALCULATE(MAX(data[ActualValue]),FILTER(ALL(data),data[UTCDateTime].[Year]=SELECTEDVALUE(data[UTCDateTime].[Year])&&data[UTCDateTime].[MonthNo]=SELECTEDVALUE(data[UTCDateTime].[MonthNo])-1&&data[PointName]=SELECTEDVALUE(data[PointName])))-MAX(data[ActualValue])

Result would be shown as below.

4.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Thanks Jay, this helps me a lot. I figured out by doing it another (messy) way. This much more cleaner DAX. I appriciate your help.

MattAllington
Community Champion
Community Champion

Read my articles here. 

https://exceleratorbi.com.au/dax-time-intelligence-beginners/

and here

 

https://exceleratorbi.com.au/building-a-matrix-with-asymmetrical-columns-and-rows-in-power-bi/

 

first you need to write your 2 measures (first article), then you need to create the table you need (second article)



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.