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
skype_see4d
Frequent Visitor

Create new table based on the comparison of values from two other tables

Hello,
I have following situation. I have table “1” and table “2”, see image.
How do I create table X which will include only Nr. form table “1” which has different description in table 2.

 

So the end result of data in table for the sample from the image would be:

Nr. from table1, Description from table 1, Description from table 2

90001, Name1, NameXVY

 

Since only the “90001” has different description in table “2”.

 Clipboard02.jpg

Thank you

Matt

1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

First you have to identify the Nr. who have a different Description. Therefore you merge your tables like this:

 

PBI_CreateNewTableComparisonTwoOthers_img1.png

 

Make sure that you've check both columns and select the "JoinKind.LeftAnti"-option.

This will return sth like this:

PBI_CreateNewTableComparisonTwoOthers_img2.png

 

Our table is selected to the correct rows, but the additional column can be ignored (as it is empty).

Next step will be to merge the 2nd table again with this new table, but this time not as a new one, but just in order to create new columns like this:

PBI_CreateNewTableComparisonTwoOthers_img3a.png

 

Choose the following options:

 

And expand:PBI_CreateNewTableComparisonTwoOthers_img3.png

PBI_CreateNewTableComparisonTwoOthers_img4.png

 

This should return what you're after.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Super User
Super User

First you have to identify the Nr. who have a different Description. Therefore you merge your tables like this:

 

PBI_CreateNewTableComparisonTwoOthers_img1.png

 

Make sure that you've check both columns and select the "JoinKind.LeftAnti"-option.

This will return sth like this:

PBI_CreateNewTableComparisonTwoOthers_img2.png

 

Our table is selected to the correct rows, but the additional column can be ignored (as it is empty).

Next step will be to merge the 2nd table again with this new table, but this time not as a new one, but just in order to create new columns like this:

PBI_CreateNewTableComparisonTwoOthers_img3a.png

 

Choose the following options:

 

And expand:PBI_CreateNewTableComparisonTwoOthers_img3.png

PBI_CreateNewTableComparisonTwoOthers_img4.png

 

This should return what you're after.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Thank you for your help. It worked like a charm. It took me a while to figure out that in first merge several columns are selected.

 

Br Matt

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.