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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
scorbin
Helper I
Helper I

How to create a new table with columns from two different tables based on dates?

I have two tables with dates in a certain range and some time data. One column in hours and the other in seconds and the third the "area". The dates aren't exactly one to one with about an extra day one either side on one of the tables. How would I go about creating a new table with one date column made up of the dates from both tables, and then two columns for the time data from each table?

 

The tables look something like this: 

Table 1: 

Column3 = Hours

scorbin_0-1650917586160.png

 


 
Table 2:

Column 3 = seconds

scorbin_1-1650917610210.png


I would want a new table like this

Column 3 = hours, column4 = seconds:

scorbin_2-1650917897570.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@scorbin , TRy merge in power query


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

 

or natural joins in dax

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

Share with Power BI Enthusiasts: 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

3 REPLIES 3
scorbin
Helper I
Helper I

Alright, I think I figured out. I appended the tables then removed any columns that I didn't need, leaving the date column, area column, and two time columns. After that I used the SUMMARIZE table function like this: 

SUMMARIZETable =
      SUMMARIZE(
               AppendTable
              ,AppendTable[Date]
              ,AppendTable[Area]
              ,"Total Hours 1"
               ,SUM(
                    AppendTable[Hours 1])
               ,"Total Hours 2"
              ,SUM(
                  AppendTable[Seconds 1]) / 3600)

 

And that got me my new table with summed amounts based on date and area, which I could now create measures one and whatever else. 

amitchandak
Super User
Super User

@scorbin , TRy merge in power query


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

 

or natural joins in dax

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

The append and merge seems to almost be what I need. However, I think I didn't provide enough info originally. The two tables have extra columns that don't match, and I was hoping to basically sum the two number columns based on the date and area columns from the original tables. Is there a way to select which columns are brought over to the new table? And would it be possible to sum the number columns based on the other two columns that do match, i.e. sum based on date and area? 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.