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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

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

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors
Top Kudoed Authors