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
DeltaZero
Regular Visitor

Finding Month-to-Month Variances From Two PowerBI Matrix

Hi, new here. Need some help with Power BI, thanks in advance and for such an awesome community.

 

I have a dataset in excel which have five different variables namely the Date, Area, Type, Region and Amounts, and I would like to present my data in Power BI similar to this format.

 

File: https://we.tl/t-lwkxPCEZas

 

PowerBI Format.png

As you can see from the image from excel, my two pivots on the left present the data such that they are of different dates i.e. 31/12/2022 and 31/01/2023. How do I create two more matrices in Power BI to show Month-on-Month Variances and % Variances?

 

Thank you!

2 ACCEPTED SOLUTIONS
v-rzhou-msft
Community Support
Community Support

Hi @DeltaZero ,

 

Here I suggest you to create measures to achieve your goal.

Current Amount = 
CALCULATE(SUM('Table'[Amounts]))
Previous Amount = 
VAR _LASTMONTH = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Date]<MAX('Table'[Date])))
RETURN
CALCULATE(SUM('Table'[Amounts]),FILTER(ALLEXCEPT('Table','Table'[Area],'Table'[Region],'Table'[Type]),'Table'[Date] = _LASTMONTH))
Month-on-Month Variances = 
[Previous Amount] - [Current Amount]
% Variances = 
DIVIDE([Month-on-Month Variances],[Current Amount])

Result is as below.

RicoZhou_0-1676619763213.png

You can show results in four matrixs and you also show them in only one matrix.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @DeltaZero ,

 

This dax formula will work if there is only one date for each month to derermind the month. Just like your sample 2022/12/31 and 2023/01/01, If you select 2023/01/01, this measure will compare it with 2022/12/31.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @DeltaZero ,

 

Here I suggest you to create measures to achieve your goal.

Current Amount = 
CALCULATE(SUM('Table'[Amounts]))
Previous Amount = 
VAR _LASTMONTH = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Date]<MAX('Table'[Date])))
RETURN
CALCULATE(SUM('Table'[Amounts]),FILTER(ALLEXCEPT('Table','Table'[Area],'Table'[Region],'Table'[Type]),'Table'[Date] = _LASTMONTH))
Month-on-Month Variances = 
[Previous Amount] - [Current Amount]
% Variances = 
DIVIDE([Month-on-Month Variances],[Current Amount])

Result is as below.

RicoZhou_0-1676619763213.png

You can show results in four matrixs and you also show them in only one matrix.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Oh wow! This is awesome, I never expect that they can be shown in just 1 matrix - the latter is so much better because I will need to put charts, and that would save me a lot of space. Just wondering - going forward, I will have date: 20230228, 20230331, 20230430...

 

Does the DAX formulae work if let's say I am on 20230430, it will automatically be compared against 20230331?

 

Also, would you be able to provide me with this PBI file instead? 🙂

 

Thanks a lot!

Hi @DeltaZero ,

 

This dax formula will work if there is only one date for each month to derermind the month. Just like your sample 2022/12/31 and 2023/01/01, If you select 2023/01/01, this measure will compare it with 2022/12/31.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.