Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a dax code the get the relationship for parent and child
| Child | Parent | Value | Relation | Results |
| 2001 | 2002 | 10 | 2001 | 10 |
| 2002 | 2003 | 15 | 2001|2002 | 25 |
| 2003 | 2004 | 20 | 2001|2002|2003 | 45 |
| 2004 | 2005 | 25 | 2001|2002|2003|2004 | 70 |
| 2005 | 2006 | 30 | 2001|2002|2003|2004|2005 | 100 |
| 2006 | 2007 | 35 | 2001|2002|2003|2004|2005|2006 | 135 |
| 2007 | 2008 | 40 | 2001|2002|2003|2004|2005|2006|2007 | 175 |
| 2008 | 2009 | 10 | 2001|2002|2003|2004|2005|2006|2007|2008 | 185 |
| 2009 | 15 | 2001|2002|2003|2004|2005|2006|2007|2008|2009 | 200 | |
| 2010 | 2011 | 20 | 2010 | 20 |
| 2011 | 25 | 2010|2011|2012|2013|2014|2015|2016 | 245 | |
| 2012 | 2011 | 30 | 2012|2013|2014|2015|2016 | 200 |
| 2013 | 2012 | 35 | 2013 | 35 |
| 2014 | 2012 | 40 | 2014 | 40 |
| 2015 | 2012 | 45 | 2015|2016 | 95 |
| 2016 | 2015 | 50 | 2016 | 50 |
Solved! Go to Solution.
P is a calculated column
P = path('Table'[Child],'Table'[Parent])
Res is a measure
Res =
var c = SELECTEDVALUE('Table'[Child])
var a= SUMMARIZE(ALLSELECTED('Table'),[Value],[P])
var b= ADDCOLUMNS(a,"inc",IF(PATHCONTAINS([P],c),[Value]))
return sumx(b,[inc])
P is a calculated column
P = path('Table'[Child],'Table'[Parent])
Res is a measure
Res =
var c = SELECTEDVALUE('Table'[Child])
var a= SUMMARIZE(ALLSELECTED('Table'),[Value],[P])
var b= ADDCOLUMNS(a,"inc",IF(PATHCONTAINS([P],c),[Value]))
return sumx(b,[inc])
@lbendlin , hi again, i use the same code to count the values
Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.
@lbendlin hi again, below should be the output table in column Result_Count and Result_Sum
I also have an issue, error showing, if i change the child and parent value as text.
Is there's a way that instead of showing in column Relation as Child/Parent as number should be the child/parent name instead. Thanks again.
Can you please post in a usable format? I can't work with screenshots.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 31 | |
| 18 | |
| 12 | |
| 11 |