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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Analitika
Post Prodigy
Post Prodigy

How properly merge tables in Power BI?

Hi,

 

I would like to add salary to main table by objects. Problem is that main table doesn't contain dates which are in second table.

When I merge queries I am getting duplicates. How fix my issue?

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Analitika ,

 

Based on your description, I have creeated a simple sample:

vjianbolimsft_0-1660791963997.png

vjianbolimsft_1-1660791978161.png

Please try:

Choose merge queries as new:

vjianbolimsft_2-1660792011302.png

Then select matching columns and choose inner as join kind:

vjianbolimsft_4-1660792207432.png

Remove the columns that you don't need

Final output:

vjianbolimsft_5-1660792298447.png

Here is the M code:

 

let
    Source = Table.NestedJoin(Table, {"Object"}, #"Table (2)", {"Object"}, "Table (2)", JoinKind.Inner),
    #"Expanded Table (2)" = Table.ExpandTableColumn(Source, "Table (2)", {"Object", "Date", "Salary"}, {"Table (2).Object", "Table (2).Date", "Table (2).Salary"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Table (2)",{{"Object", Order.Ascending}}),
    #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Table (2).Object"})
in
    #"Removed Columns"

 

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @Analitika ,

 

Based on your description, I have creeated a simple sample:

vjianbolimsft_0-1660791963997.png

vjianbolimsft_1-1660791978161.png

Please try:

Choose merge queries as new:

vjianbolimsft_2-1660792011302.png

Then select matching columns and choose inner as join kind:

vjianbolimsft_4-1660792207432.png

Remove the columns that you don't need

Final output:

vjianbolimsft_5-1660792298447.png

Here is the M code:

 

let
    Source = Table.NestedJoin(Table, {"Object"}, #"Table (2)", {"Object"}, "Table (2)", JoinKind.Inner),
    #"Expanded Table (2)" = Table.ExpandTableColumn(Source, "Table (2)", {"Object", "Date", "Salary"}, {"Table (2).Object", "Table (2).Date", "Table (2).Salary"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Table (2)",{{"Object", Order.Ascending}}),
    #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Table (2).Object"})
in
    #"Removed Columns"

 

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Bubble4502
Resolver III
Resolver III

Hi @Analitika ,

 

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Kind Regards,

Bubble

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

willjoe2442
Helper I
Helper I

To do so, follow these steps:
From the left pane of Power Query Editor, select the query into which you want the other query to merge.
Select Merge Queries > Merge Queries from the Home tab on the ribbon. 
Select State from the RetirementStats table, then select the StateCodes query.
Select OK.

 

 

Regards,

Will

Yes but then I am getting much duplicated data, that is an issue.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors