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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

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
Super User
Super User

@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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.