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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MZw
New Member

Parent-Child Hierarchy calculation with weights

Hello,

 

i'm new to PowerBI and have a question: 

I'm working with a 6 level deep parent-child hierarchy and depending on the level, the entries must be multiplied with a specific weight. The weights of a Level should not be summed up with the weights of the respective upper Level, because the upper one has its own specific weight. 

You can see the desired outcome in the last column of the example table on the right. 

In the "Weight" Column is the data, as it gets displayed (summed) without any further measures. I already tried to use "Dont summarize" but this isnt working.

In the "Weight Level 1" Column the summing for Level 1 is supressed with a specific measure:

Gewicht Level 1 =
IF(HASONEVALUE(mobilityindices[Level 2]),
   CALCULATE(SUM(mobilityindices[weight]), FILTER(VALUES(mobilityindices[Level 2]),mobilityindices[Level 2] <> "")),
   CALCULATE(SUM(mobilityindices[weight]),mobilityindices[Level 2] =""))
In the "Weight Level 2" Column happens the same:
Gewicht Level 2 =
IF( HASONEVALUE(mobilityindices[Level 3])
   ,CALCULATE(SUM(mobilityindices[weight]), FILTER(VALUES(mobilityindices[Level 3]),mobilityindices[Level 3] <> ""))
   ,CALCULATE(SUM(mobilityindices[weight]),mobilityindices[Level 3] ="" )
)
My thought was to combine the two shown (but in the end 5 similar) Measures so that the output would be my desired output.
My two questions are:
  • Is this possible?
  • Is this the right way to do it, or would another solution be better?

MZw_0-1665062858207.png

 

Thanks in advance for helping me!

MZW

 

1 REPLY 1
v-chenwuz-msft
Community Support
Community Support

Hi @MZw ,

 

I think this is feasible. Or use switch to write this function. Write the 5 formulas together. Essentially there is no difference.

 

Best Regards

Community Support Team _ chenwu zhu

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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