Forum Discussion
digitalPlay
2 years agoFrequent Visitor
Flagging Non-consecutive overlapping dates
Hello! I hope you guys could help me in solving this, I need to flag rows that have clashing date ranges against the rest of the dates for a specific location. In this example, I am subtracting cur...
DallasBaba
2 years agoSkilled Sharer
digitalPlay You can use the following DAX formula to flag rows that have clashing date ranges against the rest of the dates for a specific location:
Clash =
VAR CurrentRowEndDate = [End Date]
VAR CurrentRowStartDate = [Start Date]
VAR CurrentRowLocation = [Location]
VAR OverlappingDays =
CALCULATE(
MAX([End Date] - [Start Date] + 1),
FILTER(
'Table',
[Location] = CurrentRowLocation &&
[Start Date] <= CurrentRowEndDate &&
[End Date] >= CurrentRowStartDate &&
[ID] <> EARLIER([ID])
)
)
RETURN
IF(OverlappingDays <= 0, "No Clash", "Clash")Please note that this formula assumes that the date columns are formatted as dates in your table. If they are not, you may need to adjust the formula accordingly.
Let me know if this works for you. @ me in replies, or I'll lose your thread!!!
Note:
If this post helps, please consider Accepting it as the solution to help others find it more quickly. OR
If my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
If my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
Best Regards,
Dallas.