Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to find if date is between two ranges

Hi,   I need to find if date is within 2 ranges of dates or not.   For example, my account has two periods when it was active - from 1/1/2017 to 12/31/2017(range 1) and from 1/1/2019  to 12/31/20...
  • ToddChitt's avatar
    ToddChitt
    6 years ago

    Seems all you need to do is join (MERGE) the two datasets in Power Query on the Account column. Note that if you have one Account that has either A) Multiple Opportunities or B) Multiple 'Active' ranges, then you will get multiple records for that combination. In fact, you will get the product (multiplication) of the number of Opportunities times the number of Ranges. But that's OK. In your sample data, Account 1 will have 2 records (1 Range * 2 Opp) and Account 2 will have 8 (2 Range * 4 Opp)

     

    Then put in a calculated column that gives TRUE or FALSE based on if the Close Date was between the two Range Dates. 

    Finally, filter for the TRUE's.