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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to Join tables and Add column using DAX(Edit Query)

I have to join two tables A and B using ID.
Then add on column 'Degree' from table B to Table A
Expected O/P : Table contains column A,B & C

Input File:

Table A
IDName
111Adex
222belly
333Caty
Table B
IDDegree
111B.Com
222B.Tech
333BCA

 

Expected Ouput :

Table A
IDNameDegree
111AdexB.Com
222bellyB.Tech
333CatyBCA



Using DAX (Edit query/Transform Data)
Please help me out solving this and if possible please explain syntax to be used.


Thanks in Advance!

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Providing you have a relationship, just add a column on Table A, the paste in the following 

 

Degree = RELATED('Table B'[Degree])

 

Karlos_0-1597852339311.png

 

View solution in original post

amitchandak
Super User
Super User

@Anonymous , one is merge table in edit query

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

Dax way

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

 

New column in Table A

maxx(filter('Table B', 'Table A'[ID] ='Table B'[User ID]),'Table B'[Degree])

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
vivran22
Community Champion
Community Champion

@Anonymous 

 

DAX way:

 

LOOKUPVALUE (when there is no relationship between tables)

 

Add a new column using following DAX

Degree = LOOKUPVALUE('Table B'[Degree],'Table B'[ID],'Table A'[ID])

 

RELATED (When the tables are related)

Degree 2 = RELATED('Table B'[Degree])

 

Related article:

https://www.vivran.in/post/dax-lookupvalue

https://www.vivran.in/post/dax-data-modeling-with-related-relatedtable

 

Cheers!
Vivek

If it helps, please mark it as a solution. Kudos would be a cherry on the top 🙂
If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)

Blog: vivran.in/my-blog
Connect on LinkedIn
Follow on Twitter

vivran22
Community Champion
Community Champion

Hello @Anonymous

 

Power Query way: Merge Queries

 

With Table A selected > Home > Merge Queries:

vivran22_0-1597894478571.png

 

Select Table B in the second table and select the common column (ID in this case):

vivran22_1-1597894558330.png

 

Under Join Kind, select Left Outer. Click Ok

 

Expand the table > Select the required column from Table B

vivran22_2-1597894705535.png

 

Click Ok.

 

Output:

vivran22_3-1597894781096.png

 

For more details, you may refer to the following:

https://www.vivran.in/post/bi-simplified-webinar-1-p4-merge-queries

https://www.vivran.in/post/vlookup-joins-using-power-query

 

amitchandak
Super User
Super User

@Anonymous , one is merge table in edit query

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

Dax way

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

 

New column in Table A

maxx(filter('Table B', 'Table A'[ID] ='Table B'[User ID]),'Table B'[Degree])

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Providing you have a relationship, just add a column on Table A, the paste in the following 

 

Degree = RELATED('Table B'[Degree])

 

Karlos_0-1597852339311.png

 

What should we do if those tables have many to many relationships?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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