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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Bacou
Frequent Visitor

DAX measure to calculate parent total from child while filtering

Hi ,

 

I have two tables:
one with a parent-child hierarchy 

 

Capture.PNG

 

and another containing the data

Data.PNG

 

I created a measure to calculate  the total on each parent : 

Mesure = var c = IF(HASONEVALUE(Hierachie[IdLigne]);VALUES(Hierachie[IdLigne]);BLANK()) RETURN CALCULATE (
sum('Fact'[Amount]);
ALL('Fact');
PATHCONTAINS (Hierachie[HierarchiePath]; c )
)

Capture.PNG

It works fine but i can't use the slicers (Area and Region) , normal because i use "All" in measure.

What I would like to be able to filter and always show all the codes even if I do not have amount.

 

For Example i select "Area : A0001" and "Region : R001" i would like to have this result :

 

Code  |  Amount 

10      | 102

20      |  0

30      |  102

40      |  12048

50      | 0

60      |  12048

70      | 0

80      | 12150

 

Thank you for your help .

 

Regards

 

 

1 ACCEPTED SOLUTION

Whoops, my mistake, I didn't read close enough. You can try create a measure along the lines of:

 

Measure = 
VAR __amount = SUM(Table[Amount])
RETURN
IF(ISBLANK(__amount),0,__amount)

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

Try ALLSELECTED instead of ALL?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Greg_Deckler,
thank you for your help i try ALLSELECTED but i don't have all the codes .
Regards

Whoops, my mistake, I didn't read close enough. You can try create a measure along the lines of:

 

Measure = 
VAR __amount = SUM(Table[Amount])
RETURN
IF(ISBLANK(__amount),0,__amount)

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

I have the same problem as Bacou, but couldn't understand what your solution means.

 

I'm studying DAX as beginner, and will be appreciated if you can provide actual code based on Becou's problem. I'll apply it with my case.

 

Thank you.

 

Pat.

Thank you it works.
Regards

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors