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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

how to integrate measures into a hierarchy ?

Hello,

I would like to reproduce a P&L coming from a Database but I also want to integrate certain calculated fields into it.

For example, I want to reproduce this Excel Table in a matrix:

vneg_0-1708617182344.png

 

I had no problem reproducing the "gross margin" because it is only additions.

vneg_1-1708617476427.png

 

but iI want to add a line in the hierarchy "% External sales" ( Gross Margin / Sales - External )

 

My current table used to create my hierarchy is

Cat_1Cat_2Cat_3
Gross MarginSales - Financial AccountingSales - External
Gross MarginSales - Financial AccountingSales - Intra group

 

And the table with the book values look like this :

Cat_valuesvaluesYear_Month
Sales - Intra group56672024_02
Sales - External394612024_02
 
vneg_2-1708618340210.png

values= sum('book_values'[values])

 

How could i integrate another measure without breaking the hierarchy ?

 

Thank you

 

2 REPLIES 2
Anonymous
Not applicable

@amitchandak I have already added the row that I want to populate in the accounts table, however I cannot do a precise calculation for this line without impacting the others which are just a sum(values).
For example, I recover the Gross margin from my accounts but I want to add a row in my P&L "Gross Margin % External Sales" which would refer to : 

Gross Margin % External Sales = CALCULATE(sum('values'[values]),'Hierarchy'[cat_2]="Gross Margin")/CALCULATE(SUM('values'[values]),'Hierarchy'[cat_4] = "Sales - External"))
The excel sheet of reference is : 
vneg_0-1709743502952.png

 

amitchandak
Super User
Super User

@Anonymous , When you need P&L with additional column, you have add those in account to extended account table

 

refer

Power BI How to get the P&L formatting right: https://youtu.be/C9K8uVfthUU
Power BI How to get two columns format Profit and Loss Statement(P&L) right: https://youtu.be/WLg85yiMgHI
https://medium.com/microsoft-power-bi/power-bi-formatted-p-l-with-custom-sub-totals-and-blank-rows-e39ca822908a

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Kudoed Authors