Forum Discussion

jmp's avatar
jmp
Frequent Visitor
8 years ago
Solved

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...
  • jmp's avatar
    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]
    )