How to set up a Future Date Filter
I'm trying to figure out how to set up a beast mode that will allow me to filter out historical dates while keeping the Date Range open to Current FY. I feel like I almost had it with the below calculation, but it's cutting off anything that is scheduled after this current week time period in future months:
case when year(current_date) <= year(`Target Date`) and week(CURRENT_DATE) <= week(`Target Date`) then 'Future' else 'Historical' end
I tried to replace 'week' with 'day' and then I'm only getting the last couple of days of the month.
Essentially, if I wanted it to work properly, I need it to show me data for every day after today, until the end of our fiscal year.
Not sure what I'm doing wrong, probably something obvious I'm just overlooking, but any help is appreciated!
Have you tried just comparing the dates themselves?
CASE WHEN current_date <= `Target Date` then 'Future' else 'Historical' END
This treats a target date of today as in the future. (simply change <= to < to exclude today from the future group.
The other issue with your current logic is that both conditions must be true so for example if you had a date from January of next year it wouldn't consider it as a future date because the week check would fail even though the year is after the current year.**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2
Clarifying question. Do you actually have future dated data?
You could do something like date_format( `target_date`, '%Y-%m') to group your dates by yearMonth number and then take the count of each row, just to verify that you have future dated data.
Assuming you do, you can follow @GrantSmith 's tip with a small twist
If you only want data from the current fiscal year (assuming your fiscal calendar runs on a calendar year) then fix the pseudo-code, but this should work.
I used yearCurrent = yearTarget b/c you want THIS fiscal Year not all future dates.
case when year(current_date) = year(`Target Date`)
and CURRENT_DATE <= `Target Date` then 'FY Future'
WHEN year(current_date) < year(TargetDate) then 'Future'
else 'Historical' end
If your fiscal year does not align with the calendar year, I advise you look into using a Date Dimension table. The beast mode date functions (even with the offset calendar feature) will ALWAYS assume a calendar year.
take a look at
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0
- 7.7K All Categories
- 3 Connect
- 919 Connectors
- 244 Workbench
- 477 Transform
- 1.8K Magic ETL
- 60 SQL DataFlows
- 446 Datasets
- 37 Visualize
- 198 Beast Mode
- 2K Charting
- 8 Variables
- 18 Cards, Dashboards, Stories
- 1 Automate
- 348 APIs & Domo Developer
- 82 Apps
- 14 Predict
- 3 Jupyter Workspaces
- 11 R & Python Tiles
- 241 Distribute
- 59 Domo Everywhere
- 241 Scheduled Reports
- 15 Manage
- 36 Governance & Security
- 27 Product Ideas
- 1.1K Ideas Exchange
- Community Forums
- 14 Getting Started
- 1 Community Member Introductions
- 49 Community News
- 18 Event Recordings
- 579 日本支部