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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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.

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.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.