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

Merge queries

I am trying to merge two queries with 4 matching columns. The result query is containing two new columns(one from the secondary and other from the primary table again) apart from the primary table.Please suggest me what to do

1 ACCEPTED SOLUTION

One of the matching columns doesn't have any data i.e 'blank' . I removed that column from the table itself and then joined them . After that even though I am including that column I am still getting the desired output(no duplicate columns fromn the same table),surprising isn't it. 

 

Tools works in weird way some time. Can't believe I spend so much time on this and still dont know the root cause even though I am getting desired results.

View solution in original post

9 REPLIES 9
GilbertQ
Super User
Super User

Hi there if I understand correctly you could then remove the columns that you no longer need.

Also ensure when you are merging the data that you choose the columns in the same order from each table.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

I am adding the columns in the order as they are supppose to be.Yes I can remove the unwanted columns but I just dont understand why it is happening. There is one column in which there is no data. I guess that could be the resaon .  I want to understand how the power bi queries works exactly.

Hi there, it works a lot like a TSQL query when you are doing a right, left, inner, outer and full joins. So depending on the join that you select will be reflected in the output.

Do you have any images that you can show when you are doing the joins and then the output?

Will be easier to see what is happening.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

POWER BI Issue.PNG

Hi @Ankit041,

 

What is the result you get currently after merging these two tables? And what is your desired output?

 

By default, merging tables will combine columns from two source tables into the new one. You can delete some unwanted columns. Or you can only select the needed columns when expand the new table.

3.PNG4.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Now I am getting the desire output. But before that when I was merging the trwo queries ,instead of getting columns feom two table Iwas getting columns from primary table and repeated columns from secondary table ,i.e 2 time the same column.

 

Suppose

Table A(Primary table) has a,b,c columns and 

table B is the secondary column and I have col1,col2,col3 in thi table. I was getting total 6(a,b,c,col1,col2,col3,col1,col2,col3) columns in the merge query which is not right.

Hi @Ankit041,

 

Glad to hear that you have got desired output. So, how did you resolve this problem?

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

One of the matching columns doesn't have any data i.e 'blank' . I removed that column from the table itself and then joined them . After that even though I am including that column I am still getting the desired output(no duplicate columns fromn the same table),surprising isn't it. 

 

Tools works in weird way some time. Can't believe I spend so much time on this and still dont know the root cause even though I am getting desired results.

Hi there I think it might be getting a better understanding of what the Merge is doing?

Once you have that understanding you can then use it so that it will work in the way that you understand, as well as know how to fully utilize it going forward.

What I would suggest is to Google Joins for Databases, which will explain the different joins and what they do.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

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.