Previous Month Last Year
I'm trying to make some companion comparison cards so that I can display, for example, on one card the top 10 PDFs downloaded last month this year versus another card with the same month last year. I have the data by month already, and I need to have this for each month, moving forward.
Is there an easy way to set some cards to always look at the previous month last year?
Best Answer
-
You could use a YoY chart to show them like this on the same chart. Or, you can use a Beast Mode to filter to that date only, like:
`(CASE WHEN DATE_FORMAT(Date, '%Y-%m) = DATE_FORMAT(DATE_SUB(CURRENT_DATE(), INTERVAL 13 MONTH), '%Y-%m') THEN 'Yes' ELSE 'No' END)
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!0
Answers
-
You could use a YoY chart to show them like this on the same chart. Or, you can use a Beast Mode to filter to that date only, like:
`(CASE WHEN DATE_FORMAT(Date, '%Y-%m) = DATE_FORMAT(DATE_SUB(CURRENT_DATE(), INTERVAL 13 MONTH), '%Y-%m') THEN 'Yes' ELSE 'No' END)
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!0 -
Where, then do I use that Beast Mode? In the Date Range field?
0 -
Add the beast mode to the filter section of your card and then filter for 'Yes'.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
I'm still a little stuck. The date format is actually already calculated in the dataset to the first day of every month, and is in format like Jan 1, 2023.
0 -
Are you saying your date is stored as a string/text column and not of date data type? If so, you'll need to use the function STR_TO_DATE() to convert the column to a date first, then you can use the other Beast Mode I sent.
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!0 -
No it's in a date format, it just looks like the date format in the formula is different than the format in my dataset. Which, I think, make the formula much simpler. I just need to tell it to take the date we selected in the card and subtract 13 months.
0 -
Okay, I'm getting closer. That formula isn't quite working, so what I've done is this:
DATE_SUB(
Date
, INTERVAL 12 MONTH)I'm getting this as my filter:
Which would be fine if I were just running this for March, because the way I've done Date is to simply use the first day of the month each month. However I'm trying to automate this report so it will send every month for the previous month, so setting the exact date of 2023-03-01 won't work on an ongoing basis.
When I try something more complex, like
CASE
WHEN DATE_SUB(Date
, INTERVAL 12 MONTH) THEN 'Y'
ELSE 'N'
ENDI do get 'Y' as the option and select it, but the data itself is still only showing March of 2024, not March of 2023.
So we're really close…. I'm missing… something.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 296 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 614 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 729 Beast Mode
- 53 App Studio
- 40 Variables
- 677 Automate
- 173 Apps
- 451 APIs & Domo Developer
- 45 Workflows
- 8 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 121 Manage
- 118 Governance & Security
- Domo Community Gallery
- 32 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive