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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
vneg
Frequent Visitor

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
vneg
Frequent Visitor

@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

@vneg , 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-e...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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