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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mapko
Helper I
Helper I

PnL: Vertical Analysis % issue

All,

 

I need to implement vertical analysis to my PnL statement. 

 

My DAX query to calcualte the percentage is as follows:

 

Vertical = 'Profit & Loss Measures 1 Company'[Profit & Loss Value]/(CALCULATE(SUM('Profit & Loss Statement'[Profit & Loss Balance]),FILTER('Profit & Loss Statement','Profit & Loss Statement'[Profit & Loss Account Number]=1)))

 

End result of the above expression is:

pnl capture 1.PNG

 

So a lot of NaN and Infinity entries.

 

However, if I replace the second part of the expression (calculate.....) with a static number, say 2010 Revenue value 128,218, the the Vertical expression get evaluated correctly and correct percentages are displayed.

 

pnl capture 2.PNG

 

Any idea how to resolve this with the CALCUALTE function? I need this to be a dynamic value.

 

Thanks.

 

 

 

7 REPLIES 7
v-haibl-msft
Microsoft Employee
Microsoft Employee

@mapko

 

If the result of following DAX measure is 0 or BLANK(), you will get NaN and Infinity entries for Vertical. Just to confirm, is it as expected that you get 0 or BLANK() with following formula in some rows?

 

CALCULATE (
            SUM ( 'Profit & Loss Statement'[Profit & Loss Balance] ),
            FILTER (
                'Profit & Loss Statement',
                'Profit & Loss Statement'[Profit & Loss Account Number] = 1
            )
        )
    )

0 / BLANK () = NaN

0 / 0 = NaN

4 / BLANK () = Infinity

10 / 0 Infinity

 

Best Regards,

Herbert

@v-haibl-msft, thanks for your reply. The expectation is that the DAX measure always returns sum of the Revenue account and then divide each account within the PnL statement with this measure. 

Thank you!

@mapko

 

Is the sum of the Revenue account a dynamic value in different rows? For example, for Revenues row, its value is 128218, and for Cost of goods sold row, its value is 137317. The result of Vertical is 128218/128218 and 0/137317 for the first two rows? In that case, we need to know the calculation method of sum of the Revenue account. You’d better give some sample data of your table and the expected output.

 

Best Regards,

Herbert

@v-haibl-msft

 

I actually resolved this. Happy to share my expression if its interesting for you. 

 

Marko

@mapko

 

I would be great if you can share your expression. You can share it and then mark it as solution. It is helpful to others if they have the same problem.

 

Best Regards,

Herbert

Greg_Deckler
Super User
Super User

If you put the second part of your formula in your measure/column, what do you get? Seems like it is caculating to zero.

 

(CALCULATE(SUM('Profit & Loss Statement'[Profit & Loss Balance]),FILTER('Profit & Loss Statement','Profit & Loss Statement'[Profit & Loss Account Number]=1)))

What happens when you take out the filter?

 

Any chance you can share some sample data?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

For the revenue line it calculates the correct value. Other accounts are blank.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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