cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Simone2004
Helper I
Helper I

How to calculate differences between rows in a matrix with custom aggregations

Hi everyone,

I have this matrix

Simone2004_0-1620772150424.png

As you can see, the rows are aggregated by months, quarters and years. The values in the matrix are about sales.

 

Now I need to calculate the difference between the sales in a month and its previous one. The same must be done for quarters and years.

 

I do some examples. I need to calculate the difference between

- Year 2021 and Year 2020

- Quarter2 2020 and Quarter1 2020

- Quarter4 2020 and Quarter1 2019

- February 2021 and Jenuary 2021

- Jenuary 2021 and December 2020

 

To make things more complicated 😞 User can filters data. So for example, he could decide to visualize in the matrix data just for 2015 and 2018, then excluding 2016 and 2017. In that case, I should consider 2014 as the previous row of 2018 and not 2017.

Simone2004_1-1620772963585.png

Then, in this situation 

I need to calculate the difference between

- Year 2018 and Year 2015

- Quarter2 2018 and Quarter1 2018

- Quarter4 2015 and Quarter1 2018

- February 2018 and Jenuary 2018

- Jenuary 2018 and December 2015

 

 

Any help is appreciated. 

Thnak you

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @Simone2004,

Any update on your requirement?
You can also take a look at the following link to know how to use if statement checks current hierarchy level then you can write a formula with filter for these parameters range calculation.

Clever Hierarchy Handling in DAX - SQLBI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

HI @Simone2004,

Current power bi visual aggerate feature does not support these, you need to manually write measure formula with filter condition to calculate and compare with specific range records.

If you confused about the coding formula, please share some dummy data to test.

How to Get Your Question Answered Quickly
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@Simone2004 , as of now, power bi does not support row operations, which means the difference has come from measures.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.