Filter Month based on Last working Day

Today is Monday March 3rd. I am using the following Beast Mode (shared previously in the forums) to filter to current month:
Case
WHEN
DAY(CURRENT_DATE()) = 1
AND DATE_FORMAT(`Event Date`,'%m-%Y') = DATE_FORMAT(CURRENT_DATE()-1,'%m-%Y')
THEN '00-Current Month' WHEN
DAY(CURRENT_DATE()) != 1
AND DATE_FORMAT(`Event Date`,'%m-%Y') = DATE_FORMAT(CURRENT_DATE(),'%m-%Y')
THEN '00-Current Month' ELSE DATE_FORMAT(`Event Date`,'%m-%Y')
END
I need a beast mode to filter to the month of the last working day (Monday-Friday work week). So for today I would need it to filter the month to February (last working day being Feb 28th) and not March which is what this current beast mode does. If someone has a beast mode they can share that will do this. That would be appreciated.
Answers
-
Hi @RTM ,
Trying to understand. So you want to be able to select "current month", but that goes up to the last day of February? Apologies, I'm just not understanding the request, but I bet we can help.
John Le
Are you on my newsletter? If not, signup here so you don't miss out on my Domo tricks, alerts about my webinars, cooking tips and more
Signup here:
0 -
I want a beast mode that will filter card to month of last working day assuming a Monday to Friday work week. So for Monday March 3rd it should filter to February as the last working day was Friday Feb 28th. On Tuesday March 4th it should filter to March as last working day was Monday March 3rd. On April 1st it should filter to March and on April 2nd it should filter to April. Hopefully that helps explain what I am looking for.
0 -
Trying to help, let me know if this gets you closer. I don't think it's as much of a technical difficulty of doing what you want. It's more of a difficulty of me understanding the request, but trying:
https://www.loom.com/share/7a1b2b8a26a64df4ac35943fbd6744cc?sid=93df8072-f080-420b-8b4c-0700b51bc6e8
John Le
Are you on my newsletter? If not, signup here so you don't miss out on my Domo tricks, alerts about my webinars, cooking tips and more
Signup here:
0 -
As I understand your question, you want to filter your card to the month that the last working day is in. This is a great use case for a nested beast mode as it makes it much cleaner to look at. Here is what I would do:
Create a beast mode called LastWorkingDay with a formula that looks like this:
/* If today is Sunday, subtract 2 days /
CASE WHEN DAYOFWEEK(CURRENT_DATE()) = 1 THEN
DATE_SUB(CURRENT_DATE(), INTERVAL 2 day)
/ If today is Monday, subtract 3 days /
WHEN DAYOFWEEK(CURRENT_DATE()) = 2 THEN
DATE_SUB(CURRENT_DATE(), INTERVAL 3 day)
/ All other days, subtract 1 day */
ELSE
DATE_SUB(CURRENT_DATE(), INTERVAL 1 day)
ENDSave and validate and then create a new beast mode that looks like this:
CASE WHEN LAST_DAY(dt) = LAST_DAY(
LastWorkingDay
) THEN 'Include'
ELSE 'Exclude'
ENDDrag this into your filters and set to Include. Also, sent your date range filter last 2 months, which will keep future dates out automatically.
The first function checks to see which day of the week it is and subtracts the necessary days from the current date.
The second function uses that date and compares it to the date from your dataset (dt) and checks to see if they are in the same month and year by using the LAST_DAY function.
Hope this helps.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.2 -
Not to be outdone by John 😁, I created a video that walks you through how to do what I explained.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Thank you John and Mark for your feedback. I think both options showed me different options to reach a similar result. Sorry John that I didn't make myself clear enough and I will try to include screenshots if I have any future requests. I work in manufacturing and throughout the month we show results by day. Each morning we review the previous working day results. Current Domo filter was set to 'Current Month by Day'. I want to be able to filter the data without changing the Domo filter. When Monday March 3rd occurred the Domo filter set the card to current month March but for our meetings on the Monday March 3rd we needed to review results from February 28th. The 'it' I was referring to was the card I was using. Thanks again for your answers. I'll try them both to see which works when April roles around
0
Categories
- All Categories
- 1.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 306 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 112 SQL DataFlows
- 649 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 788 Beast Mode
- 78 App Studio
- 43 Variables
- 744 Automate
- 187 Apps
- 474 APIs & Domo Developer
- 67 Workflows
- 16 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 406 Distribute
- 117 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 139 Manage
- 136 Governance & Security
- 8 Domo Community Gallery
- 44 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive