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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
jmp
Frequent 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 and PARENT columns, however at the root level, the PARENT has a value referring to another table and is thus not blank. When i try to build the hierarchy column using

 

= PATH ( [OBJECT], [PARENT] ) 

 

i get the error (freely translated): Value 'XXXXXX' in Table[PARENT] must also exist in Table[OBJECT]. Add the missing data and try again.

 

I am able to identify the roots by a logical condition (say [PARENT] = [OTHER_COLUMN]). I have tried to encapsulate the PATH call in an IF() clause, like

 

= IF (

        [PARENT] <> [OTHER_COLUMN],

        PATH([OBJECT],[PATH])

    )

 

 

but i still get the same error. Any ideas how to handle this? Any help is appreciated.

 

1 ACCEPTED SOLUTION
jmp
Frequent 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]
)

 

View solution in original post

1 REPLY 1
jmp
Frequent 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]
)

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.