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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
soldous
Advocate II
Advocate II

Applying different weights on each level of hierarchy

Hello,

 

I have PnL fact table like this: fact_table([id],[date],[account_key],[sales_amount]) and dimension for PnL hierarchy like this: dimension_table([account_key],[level_1_name],[level_2_name],[level_2_weight],[level_3_name],[level_3_weight],[level_4_name],[level_4_weight],[level_5_name],[level_5_weight]) relationship between those table is M:N through account_key. 

I need to calculate sum of sales_amount with applying the correct weight when going from a lower level of the hierarchy to a higher one. 

Not all levels for each account is valid -> each level except one can be null.

I tried everything with INSCOPE, RELATED, SWITCH and SUMX but nothing worked for me. 

 

Link to the file here: PBIX 

 

I would very much appreciate any help. 

Thank you very much in advance.

7 REPLIES 7
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

PBIX file with sample data 

Report with sample data here.

 

Thank you

access denied

I'm sorry. It should be fixed right now. 

Looks like you mixed up your dimension and fact tables?  How are they supposed to correlate?

I didn't. 

In Fact the pnl_acc_chart_key.2 is a FK to the Dimension. In the Dim the same column is not the primary key either. I keep only the necessary columns for the demo. 

The Dim should act as a 5lvl hierarchy of accounts weight should be used when the sum of Custom form Fact goes from lower level to higher.  

Relationship is through pnl_acc_chart_key.2

So this would be the base.  I don't see weights other than 1 and -1.  Is that correct?

 

lbendlin_0-1707776932111.png

Is this what you are after?

 

lbendlin_1-1707777264755.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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