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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
sc27
Frequent Visitor

Help with measure that adds values based if Parent value is showing within a hierarchy

Hello, I am trying to figure out how to write a measure that will make a calculation based on what value is present. For example

 

ChildChild GoalParentParent Goal
Chiefs5West10
Chargers West10
Raiders West10
Broncos West10
Ravens North15
Steelers2North15
Browns North15
Bengals North15
Jets1East 
Patriots East 
Bills East 
Dolphins East 

 

I would like the Child Goal value for every row to be added ONLY if its respective Parent Goal value is blank (or zero). This data works as a hierarchy, so If a Parent Goal is showing once for West, it will show up (and have the same exact number) for every other instance of West. 

 

The Parent Goal values should also not be double counted. So using the above data, the expected Total is 10 + 15 + 1 (as this is the only Child Goal that does not have a Parent Goal value) = 26

4 REPLIES 4
amitchandak
Super User
Super User

@sc27 , Try a new column like

 

New column =
var _sum = sumx(filter(Table, [Parent] =earlier([Parent])),[Child Goal])
return
if(isblank([Parent Goal]) || [Parent Goal] =0 , _sum, [Parent Goal])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Sorry that I didn't mention this, but the data source I am using is a data model which doesn't allow me to insert columns (as far as I can tell). I also won't be able to add the column within the model itself

@sc27 , Try a measure like

 


New column =
var _sum = sumx(filter(allselected(Table), [Parent] =max([Parent])),[Child Goal])
return
if(isblank(sum(Table[Parent Goal])) || sum(Table[Parent Goal]) =0 , _sum, sum(Table[Parent Goal]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

I'm getting an error saying MAX can only evaluate numbers or dates. Does not work with Strings

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.