SUBDate As Filter?
Hi,
Can I use SubDate to filter a dataset within Magic ETL? We import our leadership team monthly. However, there are certain reports where I need the end of quarter leadership team instead of the most recent leadership team. Right now, I have the quarter end date hardcoded, but I would like to have a dynamic function.
Current: LeadershipDate = Date('2024-03-31')
Preferred: LeadershipDate = SubDate(CURRENT_DATE(),INTERVAL 1 Quarter)
I have the Leadership file > Filter Tile > Left Outer Join Tile add a Leadership flag to the main report.
Thank you!
Answers
-
The function you're looking for is DATE_SUB. You can use this, but you'll want to think through your filter. For example, do you have daily data, do you want to compare to the last day of of the month for the given quarter? If your data is updated monthly, then what is the date of that import - maybe it's better to compare month/year for the given quarter, etc. If you automate, you'll need to make sure your methodology is dialed in and behaving as expected.
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**1 -
Thanks @david_cunningham
The data is imported monthly, eventually it will be automated.
Previously, the data was only imported quarterly and I had the data tile set to filter by batch. It would pull data processed in the last 1 month. This report is generally run once a quarter so it worked but I needed to make sure the timing was correct. Then, due to an issue, I needed to replace the entire table which showed me that using Filter by Batch wasn't the best solution.
I'll play with the month/year filters.
0 -
I added a formula step to create a filter flag and then ran the leadership through the filter tile. This appears to work but will need to test and watch as the months change.
CASE
WHEN MONTH(TODAY()) IN (1, 4, 7, 10) AND LeadershipDate= SUBDATE(TODAY(),INTERVAL 1 MONTH) THEN 'Previous Quarter'
WHEN MONTH(TODAY()) IN (2, 5, 8, 11) AND LeadershipDate = SUBDATE(TODAY(),INTERVAL 2 MONTH) THEN 'Previous Quarter'
WHEN MONTH(TODAY()) IN (3, 6, 9, 12) AND LeadershipDate = SUBDATE(TODAY(),INTERVAL 3 MONTH) THEN 'Previous Quarter'END
Filter Rule = Previous Quarter
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
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 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