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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Easy look up but don't know how to do this between two tables

I am too new to PBI. I have the following table structure:

TABLE A

ID_TYPEIDINDUSTRY

SEDOL

ads12342TABLE B[INDUSTRY]
TICKERXYZTABLE B[INDUSTRY]

 

In another table I have a look up of values:

TABLE B

ALIAS_IDTICKERSEDOLISININDUSTRY
1XSXYZ123asdsFFFAAASSFood
1XYDDSads12342DSDSHeavy Metal

 

What I want to do is look up from TABLE B the value based upon what ID Type it is on TABLE A and then on TABLE A[ID] and put the industry on that table as a calculated column.

 

Should I do a merge query in Power M or a calculated lookup? What is the best way to do this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Super clever on the key. That must be years of DW experience. I just saw this in another implementation. Sorry for being such an amateur.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Super clever on the key. That must be years of DW experience. I just saw this in another implementation. Sorry for being such an amateur.

Greg_Deckler
Super User
Super User

@Anonymous Yep, if you unpivot those two columns in Table B then you could do a merge with Table A and Table B. Easier just to attache the PBIX file (below)


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@Anonymous Well, you can do this in DAX like the following:

Column = 
  SWITCH('TableA'[ID_TYPE],
    "SEDOL",LOOKUPVALUE('TableB'[Industry],'TableB'[SEDOL],'TableA'[ID]),
    "TICKER",LOOKUPVALUE('TableB'[Industry],'TableB'[TICKER],'TableA'[ID])
  )

 

Might be able to do something equivalent in M with if then else. I am going to look at one other option, unpivoting those two columns.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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