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
sya
Helper I
Helper I

Matrix with YOY GP Margin Comparisons

Hi All,

 

I need to do a YoY comparison for PnL as in the picture:

sya_0-1661238136143.png

The original data from excel was like this:

sya_1-1661238415933.png

 

I unpivot the data which made all the Revenue, GP, Direct SG&A, etc go under 1 column: Category.

And I created a sum measure for all the values.

Now I have issues with the percentages. How do I show YoY comparison for GP Margin%, net profit margin% etc in the same matrix?

 

Please help.

 

Regards,

Sya

 

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

Hi, @sya ;

Try it.

Measure = 
DIVIDE(
CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Year]=MAX('Table'[Year])&&[category]="OUP")),

CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Year]=MAX('Table'[Year])&&[category]="Revenue")))

The final show:

vyalanwumsft_0-1661931676705.png


Best Regards,
Community Support Team _ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @sya ;

Try it.

Measure = 
DIVIDE(
CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Year]=MAX('Table'[Year])&&[category]="OUP")),

CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Year]=MAX('Table'[Year])&&[category]="Revenue")))

The final show:

vyalanwumsft_0-1661931676705.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @sya ;

You could unpivot in power query.

1.unpivot.

vyalanwumsft_0-1661501727900.png

change to

vyalanwumsft_1-1661501755368.png

2.create a measure.

Measure = 
IF(HASONEVALUE('Table'[date]),SUM('Table'[Value]),
FORMAT(
DIVIDE(CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=MAX('Table'[Year]))),
       CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=MIN('Table'[Year]))))-1,
       "0.00%"))

The final show:

vyalanwumsft_2-1661502026289.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yalanwu-msft ,

 

Thank you for your help.

 

Maybe I am missing the point, but I'm looking to calculate the margin, for example using the sample you provided above, it will be:

OUP margin 2021= OUP/Revenue*100

OUP margin 2021= 7/5*100

OUP margin 2021= 140%

 

OUP margin 2022= 6/6*100

OUP margin 2021= 100%

 

So, the additional line in the Matrix after the Revenue line would be:

OUP margin | 140% | 100%

 

Please assist

amitchandak
Super User
Super User

@sya , I think calculation group can help here along with TI

Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

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.