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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.