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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Measure - Parent child relationship

Hi,

 

I need to create a measure to Parent name using id=parentid join.

 

Table

idNameParent_id
101A 
102B101
103C101
104D103
105E103

 

 

Create a Measure "Parent Name".

 

idNameParent Name
101A 
102BA
103CA
104DC
105EC

 

Can't modify the Dataset due to company policy.

 

Is there a way to calculate the measure?

 

 

1 ACCEPTED SOLUTION

Ahh, I had done mine as a measure.  Because you said you couldn't modify the data set I thought you couldn't add a column.  I have updated the calculated column to work and also added in the measure in the attached file.

 

View solution in original post

6 REPLIES 6
jdbuchanan71
Super User
Super User

Hello @Anonymous 

Give this a try.

Parent Name =
VAR RowParent =
    SELECTEDVALUE ( 'Your Table'[Parent_id] )
RETURN
    IF (
        ISBLANK ( RowParent ),
        "n/a",
        LOOKUPVALUE ( 'Your Table'[Name], 'Your Table'[id], RowParent )
    )

 parentname.jpg

Strange. I tried your solution, why mine is showing n/a?

 

2019_08_15_09_08_33_Untitled_Power_BI_Desktop.png

In your table, is ID a number and Parent ID text?

Both are text.

I changed to number and still the same.

Here  is the pbix

Ahh, I had done mine as a measure.  Because you said you couldn't modify the data set I thought you couldn't add a column.  I have updated the calculated column to work and also added in the measure in the attached file.

 

oops, I am not the one who posted. I gaveit a try because I want to learn.

And you did not fail me, I really did learn something new from you today.

 

Thank you @jdbuchanan71 ! You are awesome!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.