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
adoster
Resolver I
Resolver I

Create a new column using data from 2 other related tables

I have 3 related tables. I am trying to create a new column based on values from the other 2 tables.

 

Table A

NameOld Code
Mickey Mouse11111
Donald Duck11111
Iron Man22222
Captain America33333
Black Widow44444
Iron Man55555

 

Table B

Original CodeNew Code
1111112345
2222223456
3333334567
4444445678
5555556789

 

Table C

NameTypeCode
Mickey MouseDisney77777
Donald DuckDisney77777
SupermanDC Comics88888
Iron ManMarvelSee Table B
Captain AmericaMarvelSee Table B
Black WidowMarvelSee Table B

 

Something similar to:

IF ('Table C'[Type] = "Marvel" THEN 'Table B'[New Code]) ,  ELSE 'Table C'[Code]

 

Here are the reulst for these sample Tables

NameOriginal CodeNEW Code Results
Mickey Mouse1111177777
Donald Duck1111177777
Superman2222288888
Iron Man2222223456
Captain America3333334567
Black Widow4444445678
Iron Man5555556789

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@adoster Maybe:

Column = 
  IF (RELATED('Table C'[Type]) = "Marvel", RELATED('Table B'[New Code]),RELATED('Table C'[Type]))

@ 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...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@adoster Maybe:

Column = 
  IF (RELATED('Table C'[Type]) = "Marvel", RELATED('Table B'[New Code]),RELATED('Table C'[Type]))

@ 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.