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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
saralsaral
Frequent Visitor

Find Parent of Parent with DAX

I have simple task, I need to obtain the 'Grandparent' of an item. The Parent ID is already a column in the data, just need the Granparent ID. I tried LOOKUPVALUE, but I don't know what the 3rd argument will be?

 

 

Parent_of_Parent_ID = LOOKUPVALUE('Table'[Parent ID], 'Table'[ID], )

 

 

 

 

Name           IDParent ID                       Expected_Output (Parent of Parent)
foo101215
bar121518
baz1518 
buzz18  
1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @saralsaral ,

You can try below code:-

 

Parent of Parent =
VAR _path =
    PATH ( 'Parent_hirarchy'[ID], Parent_hirarchy[Parent ID] )
RETURN
    PATHITEMREVERSE ( _path, 3 )

 

Output:-

image.png

 

Thanks

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

2 REPLIES 2
Samarth_18
Community Champion
Community Champion

Hi @saralsaral ,

You can try below code:-

 

Parent of Parent =
VAR _path =
    PATH ( 'Parent_hirarchy'[ID], Parent_hirarchy[Parent ID] )
RETURN
    PATHITEMREVERSE ( _path, 3 )

 

Output:-

image.png

 

Thanks

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @saralsaral ,

 

https://docs.microsoft.com/en-us/dax/understanding-functions-for-parent-child-hierarchies-in-dax

 

Please refer above link.

 

 

Mark this as a solution if I answered your question.

Thanks.

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.