Overlapping Date Beast Mode
Hi everyone! For context, I am making a card that flags overlapping contract dates. I want to make sure that the first order finishes its duration first before having another order. I only want to partition the overlap flag by customer and by the same business unit. Please see the Excel visualization sample I made below. Can anyone help on my beast mode for the Overlap? Thank you!
Best Answer
-
I approached this using Magic ETL, and here is how I did it:
1. Create a Lead and Lag function to get the previous End Date and the upcoming Start Date.2. Create a formula to flag when there is overlap. (also by creating this I noticed that your data in the excel screenshot for overlap appears wrong. For Customer ABC there is overlap with order number 3 ending 12/30/2025 and order number 4 starting 1/1/2025)
If I solved your problem, please select "yes" above
1
Answers
-
I approached this using Magic ETL, and here is how I did it:
1. Create a Lead and Lag function to get the previous End Date and the upcoming Start Date.2. Create a formula to flag when there is overlap. (also by creating this I noticed that your data in the excel screenshot for overlap appears wrong. For Customer ABC there is overlap with order number 3 ending 12/30/2025 and order number 4 starting 1/1/2025)
If I solved your problem, please select "yes" above
1 -
I think you are getting confused by your data. The answers to your data would not be what you show. Your last record overlaps but your display says it doesn't. I did it using SQL Dataflow.
SELECT
a.order_number,
a.customer,
a.business_unit,
CASE
WHEN a.start_date < b.end_date AND a.end_date > b.start_date THEN 'Yes'
ELSE 'No'
END AS overlap_flag
FROM overlap_test a
JOIN overlap_test b
ON a.customer = b.customer
AND a.business_unit = b.business_unit
AND a.order_number != b.order_number
ORDER BY a.order_number;
But to get the answer you show, I had to change the record date on the last record so it wouldn't overlap.customer
order_number
business_unit
start_date
end_date
xyz
1
BU1
1/1/2023
12/31/2024
xyz
2
BU1
12/29/2024
12/30/2025
abc
3
BU2
12/29/2024
12/30/2025
abc
4
BU2
1/1/2026
12/31/2026
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive