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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
kellzp22
Frequent Visitor

Merging Tables with Date Condition

Hi, 

 

I am trying to merge two tables together. The first table is a jobs table, which provides an employee their start time, end time and  location. I'd like to merge this will a bed allocation table, so that if the shift is at the same location and within the allocation date range, then the Job. No. should be allocated to the Bed Allocation table.

 

Jobs Table: 

kellzp22_0-1645592871545.png

Bed Allocation:

kellzp22_0-1645593288473.png

 

 

Bed Allocation (Once Merged):

kellzp22_2-1645592926881.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @kellzp22 ,

 

You can use the Merge fetaure.

Sample data

Jobs:

vstephenmsft_0-1646386070162.png

Bed Allocation:

vstephenmsft_1-1646386078977.png

 

1.Select 'Merge Queries as New', and then set as follows, click OK.

vstephenmsft_2-1646386117755.png

vstephenmsft_3-1646386127509.png

vstephenmsft_5-1646386204682.png

 

2.Expand all columns.

vstephenmsft_4-1646386197171.png

 

3.Add a custom column.

vstephenmsft_6-1646386236216.png

vstephenmsft_7-1646386257039.png

 

 

4.Filter out the rows with a custom column value of 1, then remove unnecessary columns, and the final result.

vstephenmsft_8-1646386272188.png

vstephenmsft_10-1646386340881.png

Result:

vstephenmsft_9-1646386330820.png

 

You can check more details from the attachment.

 

Best Regards,

Stephen Tao

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @kellzp22 ,

 

You can use the Merge fetaure.

Sample data

Jobs:

vstephenmsft_0-1646386070162.png

Bed Allocation:

vstephenmsft_1-1646386078977.png

 

1.Select 'Merge Queries as New', and then set as follows, click OK.

vstephenmsft_2-1646386117755.png

vstephenmsft_3-1646386127509.png

vstephenmsft_5-1646386204682.png

 

2.Expand all columns.

vstephenmsft_4-1646386197171.png

 

3.Add a custom column.

vstephenmsft_6-1646386236216.png

vstephenmsft_7-1646386257039.png

 

 

4.Filter out the rows with a custom column value of 1, then remove unnecessary columns, and the final result.

vstephenmsft_8-1646386272188.png

vstephenmsft_10-1646386340881.png

Result:

vstephenmsft_9-1646386330820.png

 

You can check more details from the attachment.

 

Best Regards,

Stephen Tao

 

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

 

 

What if some Locations has no data in Allocation table, they will be filtered, I want to keep the null values?

VijayP
Community Champion
Community Champion

@kellzp22 
in the both the Tables you must have similar column (1 column atleast) which is now missing,

So, Create a columns in both Tables with Location & EndDateTime and the try merging based on that column in both the tables to get the result !Share you kudos




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.