Forum Discussion
jmp
8 years agoFrequent Visitor
PATH with no blank parent field in root
I am trying to create a hierarchical tree using the PATH function based on the article https://www.daxpatterns.com/parent-child-hierarchies/. My table (imported from DB) has the typical OBJECT an...
- 8 years ago
I found a workaround in this post: https://powerpivotpro.com/2017/12/imagine-people-tables/
This created a new parent column with root-nodes referring to itself as parent, which allows the PATH() function to do it's work.
NewParent = IF( COUNTROWS( FILTER( TABLE, TABLE[OBJECT] = EARLIER(TABLE[PARENT]) ) ) = 0, TABLE[OBJECT], TABLE[PARENT] )
jmp
8 years agoFrequent Visitor
I found a workaround in this post: https://powerpivotpro.com/2017/12/imagine-people-tables/
This created a new parent column with root-nodes referring to itself as parent, which allows the PATH() function to do it's work.
NewParent =
IF(
COUNTROWS(
FILTER(
TABLE,
TABLE[OBJECT] = EARLIER(TABLE[PARENT])
)
) = 0,
TABLE[OBJECT],
TABLE[PARENT]
)