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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Kavithaa
New Member

Lookup with mutiple table - If else loop condition

I have 2 tables as below. I have to create a new coloumn in "PO Table" - The value should be looked up from "Org Table".

Requester has to be looked wiht "Org Table - Engineer", then whatever the entries as not found - has to be looked up with "Org Table - Team Leader", 

then whatever the entries as not found - has to be looked up with "Org Table - Manager", 

then whatever the entries as not found - has to be looked up with "Org Table - Senior Manager", 

 

Can someone help me with the query.

 

PO Table:

 

RequesterPO NumberCostPO Date
John123 €  100.0003/05/2023
Cristy234 €  200.0023/04/2023
Tom321 €  300.0021/04/2023
Rocky432 €  400.0031/04/2023
Mitchel111 €  150.0001/05/2023
Kevin211 €    50.0001/05/2023

Org Table:

 

EngineerTeam LeaderManagerSenior Manager
JohnCristyTomRocky
MichaelCristyTomRocky
AngelaMitchelTomRocky
TonyMitchelKevinRocky

 

 

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

Not sure what is the output you are looking for ?

 

Check this sample, if this is what you are looking for ...

 

Source: PO Table and Org Tables:

sevenhills_0-1688410816784.png

Relationships:

sevenhills_1-1688410841946.png

 

Measure:

Requester Level = 
var _sel = SELECTEDVALUE('PO Table'[Requester])

var _LevelID = SWITCH( TRUE(), 
    -- is Engineer?
    LOOKUPVALUE('Org Table'[L4 ID], 'Org Table'[Engineer], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L4 ID], 'Org Table'[Engineer], _sel),
    -- is team leader
    LOOKUPVALUE('Org Table'[L3 ID], 'Org Table'[Team Leader], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L3 ID], 'Org Table'[Team Leader], _sel),
    -- is Manager
    LOOKUPVALUE('Org Table'[L2 ID], 'Org Table'[Manager], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L2 ID], 'Org Table'[Manager], _sel),
    -- is Senion Manager
    LOOKUPVALUE('Org Table'[L1 ID], 'Org Table'[Senior Manager], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L1 ID], 'Org Table'[Senior Manager], _sel),
    BLANK()
)

RETURN _LevelID

 

Final output:

sevenhills_3-1688410943343.png

 

View solution in original post

1 REPLY 1
sevenhills
Super User
Super User

Not sure what is the output you are looking for ?

 

Check this sample, if this is what you are looking for ...

 

Source: PO Table and Org Tables:

sevenhills_0-1688410816784.png

Relationships:

sevenhills_1-1688410841946.png

 

Measure:

Requester Level = 
var _sel = SELECTEDVALUE('PO Table'[Requester])

var _LevelID = SWITCH( TRUE(), 
    -- is Engineer?
    LOOKUPVALUE('Org Table'[L4 ID], 'Org Table'[Engineer], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L4 ID], 'Org Table'[Engineer], _sel),
    -- is team leader
    LOOKUPVALUE('Org Table'[L3 ID], 'Org Table'[Team Leader], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L3 ID], 'Org Table'[Team Leader], _sel),
    -- is Manager
    LOOKUPVALUE('Org Table'[L2 ID], 'Org Table'[Manager], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L2 ID], 'Org Table'[Manager], _sel),
    -- is Senion Manager
    LOOKUPVALUE('Org Table'[L1 ID], 'Org Table'[Senior Manager], _sel) <> BLANK(), LOOKUPVALUE('Org Table'[L1 ID], 'Org Table'[Senior Manager], _sel),
    BLANK()
)

RETURN _LevelID

 

Final output:

sevenhills_3-1688410943343.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.