Previous 4 weeks and next 4 weeks data
I want to scheduled a report to go out every Monday. This I know how to do.
I want the report to look at the last/previous 4 weeks and the next 4 weeks. But I want it to do this automatically every week. So every Monday it will look 4 weeks back and 4 weeks forward and the report will send as scheduled.
Is there a way to have the report automatically do this?
Best Answers
-
Hi @Rvannoy
You can't dynamically configure the date selector to go 4 weeks back and 4 weeks forward in the same report. You could configure the card to have a beast mode such that it will compare the date to now - 4 weeks and now + 4 weeks and then return to include it or not.
CASE WHEN `date_field` = CURRENT_DATE() - INTERVAL '4' WEEK AND `date_field = CURRENT_DATE() + '4' WEEK THEN 'Include' ELSE 'Exclude' END
Then filter your card so that the beast mode is set to 'Include' and schedule your report then. It should take into account any current filtering you have on the card.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3 -
@GrantSmith I created the beast mode on the card using the case statement as shown above. replacing 'date_field' with ship_date the formula was accepted.
(CASE WHEN `Ship_Date` = CURRENT_DATE() - INTERVAL '4' WEEK AND `Ship_Date` = CURRENT_DATE() + INTERVAL '4' WEEK THEN 'INCLUDE'
ELSE 'EXCLUDE' END)
When I use the beast mode in the filter section of the card it only gives me the option for EXCLUDE.
When the scheduled report goes out on Monday's that is when I need it to look at the 4 previous for 4 weeks and next 4 weeks. When I am just viewing the report on a daily basis I need to be able to just use the date selector to view the dates I select.
0 -
You need to change the equals to greater than and equal to and less than and equal to like this:
(CASE WHEN `Ship_Date` >= CURRENT_DATE() - INTERVAL '4' WEEK AND `Ship_Date` <= CURRENT_DATE() + INTERVAL '4' WEEK THEN 'INCLUDE' ELSE 'EXCLUDE' END)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.2 -
Thanks @MarkSnodgrass
I left out the greater than and less than because it kept auto formatting it as a quote and forgot to put them back in.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2
Answers
-
Hi @Rvannoy
You can't dynamically configure the date selector to go 4 weeks back and 4 weeks forward in the same report. You could configure the card to have a beast mode such that it will compare the date to now - 4 weeks and now + 4 weeks and then return to include it or not.
CASE WHEN `date_field` = CURRENT_DATE() - INTERVAL '4' WEEK AND `date_field = CURRENT_DATE() + '4' WEEK THEN 'Include' ELSE 'Exclude' END
Then filter your card so that the beast mode is set to 'Include' and schedule your report then. It should take into account any current filtering you have on the card.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3 -
@GrantSmith I created the beast mode on the card using the case statement as shown above. replacing 'date_field' with ship_date the formula was accepted.
(CASE WHEN `Ship_Date` = CURRENT_DATE() - INTERVAL '4' WEEK AND `Ship_Date` = CURRENT_DATE() + INTERVAL '4' WEEK THEN 'INCLUDE'
ELSE 'EXCLUDE' END)
When I use the beast mode in the filter section of the card it only gives me the option for EXCLUDE.
When the scheduled report goes out on Monday's that is when I need it to look at the 4 previous for 4 weeks and next 4 weeks. When I am just viewing the report on a daily basis I need to be able to just use the date selector to view the dates I select.
0 -
You need to change the equals to greater than and equal to and less than and equal to like this:
(CASE WHEN `Ship_Date` >= CURRENT_DATE() - INTERVAL '4' WEEK AND `Ship_Date` <= CURRENT_DATE() + INTERVAL '4' WEEK THEN 'INCLUDE' ELSE 'EXCLUDE' END)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.2 -
Thanks @MarkSnodgrass
I left out the greater than and less than because it kept auto formatting it as a quote and forgot to put them back in.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2 -
@GrantSmith Hello, I am trying to look the data just looking at 4 weeks back and then on a sperate card looking 4 weeks forward. When I use the formula
(CASE WHEN `Ship_Date` >= CURRENT_DATE() - INTERVAL '4' WEEK then 'Include" else 'Exclude') It is not giving me the data for just the 4 week period. What am I doing wrong?
0 -
@GrantSmith Sorry, formula is
CASE WHEN `Ship_Date` >= CURRENT_DATE() - INTERVAL '4' WEEK then 'Include" else 'Exclude' end)
The 4 week backward and 4 week forward formula is working fine. I need to have one that looks at the data for a 4 week backward-looking and a separate on 4 week forward-looking. There is other different criteria depending on how it is viewed. This is why I need to have 2 separate views of the data. I just can not seem to get the beast mode work when I try and just look at the 4 weeks period either going forward or backward.
0 -
@MarkSnodgrass Hello, I am trying to look my data just 4 week in the past and then in a sperate report 4 weeks looking forward. The 4 week back and 4 week forward is working but when I try and sperate them to just look 4 weeks back and then 4 weeks forward I cannot seem to get it to work.
CASE WHEN `Ship_Date` >= CURRENT_DATE() - INTERVAL '4' WEEK then 'Include" else 'Exclude' end)
The 4 week backward and 4 week forward formula is working fine. I need to have one that looks at the data for a 4 week backward-looking and a separate on 4 week forward-looking. There is other different criteria depending on how it is viewed. This is why I need to have 2 separate views of the data. I just can not seem to get the beast mode work when I try and just look at the 4 weeks period either going forward or backward.
0 -
This is how I would write it and then you can filter to whichever result you want in each card.
CASE WHEN `dt` <= DATE_ADD(CURRENT_DATE(), INTERVAL 4 WEEK) and `dt` >= CURRENT_DATE() then 'Within 4 weeks in the future' WHEN `dt` >= DATE_SUB(CURRENT_DATE(), INTERVAL 4 WEEK) and `dt` <= CURRENT_DATE() then 'Within 4 weeks prior' else 'Outside of 4 weeks past and future' end
Using the date_add function will add 4 weeks to the current date and date_sub will subtract 4 weeks from the current date. I adjust the greater than and less than signs accordingly.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 621 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 743 Beast Mode
- 58 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 395 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive