Forum Discussion

Lost_Number's avatar
Lost_Number
Frequent Visitor
2 years ago
Solved

Merge based on date ranges

I am fairly new to PowerBI and really can seem to find a specific or even related solution online to my problem.

 

The issue:

 

Table1 is a list of Sales persons with Start date / End date and target values

PersonStartEndTarget
SP110/01/202301/12/202310000
SP215/04/202319/05/2023100
SP301/01/202331/08/2023315

 

Table2 is a list of dates that starts from the List.Min(Start) to List.Max(End) of Table1.

 

I need to merge Table2 to Table1 but for every date (row level) in Table2 for each sales person within each start to end range.

 

the output would end up showing a row for every date in Table2 duplicated for each sales person between their respective Start and End date.

 

I have already played around with merge and creating additional join columns but I can't seem to get the correct output. I know this can also be done with Dax using crossjoin and filter but I have to build this into power query.

 

Thanks in advance

2 Replies