The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello everyone
I hope you can help me with my Parent Child Hierarchy problem.
I want to use a Dax measure to make the amount from the fact table (on hierarchy leaves) available on all node levels.
The specialty is that I want to use the flat hierarchy column “Name” from the table “Hierarchy” in the visual.
In the attached picture you can see the test data and the desired result.
Solved! Go to Solution.
Hi @polestar_11
You can try below measure.
Measure =
SUMX(
SUMMARIZE('Hierarchy','Hierarchy'[Name],'Hierarchy'[ID]),
CALCULATE(
SUM('Fact'[Amount]),
TREATAS(
CALCULATETABLE(
VALUES('Hierarchy'[ID]),
PATHCONTAINS('Hierarchy'[Path],EARLIER('Hierarchy'[ID])),
ALL()
),
'Fact'[ID]
)
)
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Hi @polestar_11
You can try below measure.
Measure =
SUMX(
SUMMARIZE('Hierarchy','Hierarchy'[Name],'Hierarchy'[ID]),
CALCULATE(
SUM('Fact'[Amount]),
TREATAS(
CALCULATETABLE(
VALUES('Hierarchy'[ID]),
PATHCONTAINS('Hierarchy'[Path],EARLIER('Hierarchy'[ID])),
ALL()
),
'Fact'[ID]
)
)
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
That works perfect. What is the Reason that it doesn't work with a relation between the two tables? Is there a solution with a relation?
Hi @polestar_11, try these measures below, and if you encounter any issues, let me know.
Create a measure for Total Amount:
Total Amount = SUM('Fact Table'[Amount])
Create a measure for Hierarchy Aggregation
Aggregated Amount =
VAR CurrentNode = MAX('Hierarchy'[Name])
RETURN
CALCULATE(
[Total Amount],
FILTER(
ALL('Hierarchy'),
PATHCONTAINS('Hierarchy'[Path], CurrentNode)
)
)
Did I answer your question? If so, please mark my post as the solution!✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!
User | Count |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
19 | |
12 | |
9 | |
5 |