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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
BrandonH
Frequent Visitor

Conditional Merge Using IF Logic and Evaluation

Hello All, 

I am working on a project spanning 20+ queries. One of the evaluations I am trying to accomplish is to take a 'Training Date' in query 1 and evaluate if this date is in between a start date in one column and an end date in another column of query 2. If so then to return the record in query 2 that the date for query 1 falls within.

 

I know this is all very vauge. I am working with some protected information and would like to avoid sharing datasets or pictures unless explicitly needed.

 

I appreciate any insight you all may have. This may be my first post but I have visited the site before in my many searches for answers. 🙂 

 

 

1 ACCEPTED SOLUTION
tackytechtom
Most Valuable Professional
Most Valuable Professional

Hi @BrandonH ,

 

Spontaneously, I would try to change the granulariity of query2. More precisely, I'd unfold the data in query2 so one row of the table will become several rows where each row represents one day of the interval (start and end date). Afterwards join query1 and query2 in order to display the matches.

 

Here one way of detangling query2:

https://www.tackytech.blog/how-to-swiftly-take-over-power-query/#1_Unfold_expand_create_rows_between...

 

Note, this can be performance-heavy depending on the size of your tables, but maybe worth a shot anyway.

 

Let me know if this helps! 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Most Valuable Professional
Most Valuable Professional

Hi @BrandonH ,

 

Spontaneously, I would try to change the granulariity of query2. More precisely, I'd unfold the data in query2 so one row of the table will become several rows where each row represents one day of the interval (start and end date). Afterwards join query1 and query2 in order to display the matches.

 

Here one way of detangling query2:

https://www.tackytech.blog/how-to-swiftly-take-over-power-query/#1_Unfold_expand_create_rows_between...

 

Note, this can be performance-heavy depending on the size of your tables, but maybe worth a shot anyway.

 

Let me know if this helps! 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Hello @tackytechtom

 

I appreciate the response and time you took to provide feedback. I will work today to try to unfold the data in my second query. I will provicde some feedback sometime soon and accept as a solution if I can get it working. Take care!

Helpful resources

Announcements
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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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