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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
CarlsBerg999
Helper V
Helper V

Lookup from the same table

Hi, 

 

My data looks like the picture below. What i need to do is a calculated column (green), where each Child gets the name of the Parent.

- Each Child has a Parent 

- The Parent column works as a lookup for the ID column in the same table 

 

CarlsBerg999_0-1657377923161.png

 

What i have so far is: 

CALCULATE(MAX('Table'[Name]),
FILTER('Table','Table'[ID]=EARLIER('Table'[Parent])))

 

--> This produces empty values. Does anyone have an idea how to fix this?

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @CarlsBerg999 ;

You could use column or measure by dax:

 

COLUMN = 
 CALCULATE(MAX('Table'[Name]),
FILTER('Table','Table'[ID]=EARLIER('Table'[Parent])))
Measure = 
 CALCULATE(MAX('Table'[Name]),
FILTER(ALL('Table'),'Table'[ID]=MAX('Table'[Parent])))

 

The final show:

vyalanwumsft_0-1657609527387.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
speedramps
Super User
Super User

Please click thumbs up and accept one of the solutions. Thank you.

v-yalanwu-msft
Community Support
Community Support

Hi, @CarlsBerg999 ;

You could use column or measure by dax:

 

COLUMN = 
 CALCULATE(MAX('Table'[Name]),
FILTER('Table','Table'[ID]=EARLIER('Table'[Parent])))
Measure = 
 CALCULATE(MAX('Table'[Name]),
FILTER(ALL('Table'),'Table'[ID]=MAX('Table'[Parent])))

 

The final show:

vyalanwumsft_0-1657609527387.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

speedramps
Super User
Super User

Try this .... 

 

Goal =

VAR myparent= SELECTEDVALUE('Table'[Parent])
RETURN
CALCULATE(
SELECTEDVALUE('Table'[Name]),
ALL('Table'),
'Table'[ID] = myparent
)
 
Nect time please copy and paste example tables as data into chats so we cam import the data and build solutions. Dont send snap shorts. It takes ages to retype it ☹️
 

Thanks for reaching out for help.

I have helped you, now please help me by giving kudos.

Remeber we are unpaid volunteers.

Click the thumbs up and accept as solution button. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you !

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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