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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Fetching Id from another table

Hi,

I have a issue that I have been trying to solve but couldnt get around it. 

I have  2 tables, table A and table B.

Columns for table A:

Name                         Id                 Subname        

Jason                                                G1

Mark                                                 G2

Jason                                                G3

Eason                                                G4

 

Example for table B:

Id                             Owner                   

268                          Jason                      

64                            Jason

45                            Eason

34                            Mark

 

The end result for table A should be:

Columns for table A:

Name                         Id                          Subname

Jason                          268                       G1

Mark                           34                         G2

Jason                          64                         G3

Eason                          45                        G4

 

The relationship between table A and table B is many-to-one relationship.

I have tried making the Id column in table A as a calculated column and using this formula.

Id = SWITCH([Name],[Name],IF([Name]==tableB[Owner], tableB[Id])) , but I dont get the dropdown listing for tableB. 
 
Is there anywhere that i am doing this wrong? 
 
Any help is appreciated. Thanks
2 ACCEPTED SOLUTIONS
jdbuchanan71
Super User
Super User

Sub Name on table B would get you to a key column (the name and sub name together) that you could do a LOOKUPVALUE on.

View solution in original post

v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

The system does not recognize duplicate values. For each value corresponding to two results, the following four scenarios occur

 

vpollymsft_0-1645506197046.png

 

If there are 2 rows with the same name in table B, you should add another condition for the duplicate value to differentiate

 

 

Best Regards

Community Support Team _ Polly

 

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

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

The system does not recognize duplicate values. For each value corresponding to two results, the following four scenarios occur

 

vpollymsft_0-1645506197046.png

 

If there are 2 rows with the same name in table B, you should add another condition for the duplicate value to differentiate

 

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

jdbuchanan71
Super User
Super User

Sub Name on table B would get you to a key column (the name and sub name together) that you could do a LOOKUPVALUE on.

Anonymous
Not applicable

Thanks for your feedback. It made me re-think my problem. My thought process is if there are 2 rows with the same name from table B, the system should populate table A with two different ids for each row with the same name. 

Or should i re-look this to introduce another key in table A and table B to make it distinct?

 

jdbuchanan71
Super User
Super User

@Anonymous 

Based on just the name in table A, how is the system supposed to know which Jason is the correct one?

jdbuchanan71_0-1645206056441.png

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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