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
Sam2209
New Member

Merge Five and more dataset to create one single dataset

this is sample table: 

I have four different tables: 

 

City                        ID 2015

Jaipur4
tripura5
Frankfurt7

 

City           ID 2016

Jaipur5
tripura6
berlin7

 

City           ID 2017

Jaipur7
grt4
raipur7

 

City ID            2018

Bremen5
Leipzig7
Freiberg9

 

I have to merge and create a single table like this : 

 

City                        ID 2015    ID 2016   ID 2017    ID 2018

Newyork457 
Tokyo567 
Frankfurt7   
Berlin 7  
Milan  4 
Bremen   5
Leipzig   7
Dresden   9
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new table.

 

Picture1.png

 

New Table = 
ADDCOLUMNS (
    SUMMARIZE ( UNION ( Table1, Table2, Table3, Table4 ), [City] ),
    "@2015", CALCULATE ( SUM ( Table1[2015] ), Table1[City] = EARLIER ( [City] ) ),
    "@2016", CALCULATE ( SUM ( Table2[2016] ), Table2[City] = EARLIER ( [City] ) ),
    "@2017", CALCULATE ( SUM ( Table3[2017] ), Table3[City] = EARLIER ( [City] ) ),
    "@2018", CALCULATE ( SUM ( Table4[2018] ), Table4[City] = EARLIER ( [City] ) )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new table.

 

Picture1.png

 

New Table = 
ADDCOLUMNS (
    SUMMARIZE ( UNION ( Table1, Table2, Table3, Table4 ), [City] ),
    "@2015", CALCULATE ( SUM ( Table1[2015] ), Table1[City] = EARLIER ( [City] ) ),
    "@2016", CALCULATE ( SUM ( Table2[2016] ), Table2[City] = EARLIER ( [City] ) ),
    "@2017", CALCULATE ( SUM ( Table3[2017] ), Table3[City] = EARLIER ( [City] ) ),
    "@2018", CALCULATE ( SUM ( Table4[2018] ), Table4[City] = EARLIER ( [City] ) )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


mh2587
Super User
Super User

First combine two tables after that then combine the merged tables hope this worked


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



mh2587
Super User
Super User

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


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Thanks for reply. 

But in merge queries, i can combine only two tables.

How to combine multiple tables?

Sam2209_0-1649419184879.png

 

 

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.