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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.