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
SBR1D
Helper II
Helper II

Tricky calculated column lookup

Hi All

 

In the following example table I want to do a  calculated column to look up from the application table to employer table returning the Parent Employer.

name.

 

I've filled in what the outcome should be in the applications table in red text.

 

Thanks in advance.

 

 

Applications table     Employer table  
EmployerIDEmployer nameParent Employer Name   ParentIDEmployerIDEmployer name
11Employer AA1Employer AA1   1111Employer AA1
12Employer BB1Employer BB1   1212Employer BB1
13Employer CC1Employer CC1   1313Employer CC1
14Employer DD1Employer DD1   1414Employer DD1
15Employer AA2Employer AA1   1115Employer AA2
16Employer BB2Employer BB1   1216Employer BB2
17Employer CC2Employer CC1   1317Employer CC2
18Employer DD2Employer DD1   1418Employer DD2
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

There are PATH functions that can handle recursive hierarchy structures like I think your Employer table is intended to have. See here for details on that: https://www.daxpatterns.com/parent-child-hierarchies/

 

For this, you can probably get away with two lookups like this:

Parent Employer Name =
VAR _ParentID =
    LOOKUPVALUE (
        Employer[ParentID],
        Employer[EmployerID], Applications[EmployerID]
    )
VAR _ParentName =
    LOOKUPVALUE (
        Employer[Employer name],
        Employer[EmployerID], _ParentID
    )
RETURN
    _ParentName

View solution in original post

2 REPLIES 2
SBR1D
Helper II
Helper II

Thank you so much. I will take a look into the link you have provided, I am not sure why the company chose to model the data like this as it is confusing. Unfortuanately, we use 3rd party software/databae so i am unable to change the model.

 

But your solution works so thanks and have a great day.

AlexisOlson
Super User
Super User

There are PATH functions that can handle recursive hierarchy structures like I think your Employer table is intended to have. See here for details on that: https://www.daxpatterns.com/parent-child-hierarchies/

 

For this, you can probably get away with two lookups like this:

Parent Employer Name =
VAR _ParentID =
    LOOKUPVALUE (
        Employer[ParentID],
        Employer[EmployerID], Applications[EmployerID]
    )
VAR _ParentName =
    LOOKUPVALUE (
        Employer[Employer name],
        Employer[EmployerID], _ParentID
    )
RETURN
    _ParentName

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.