How to show a month position as at 12 months ago
Hi all,
I'm working on a set of data and for one of my cards I would like to show a pie chart of the total position for the current month and a separate pie chart for the position as at 12 months ago. I'm not sure how best to show this as the date options only seem to allow for the cumulative last 12 months - I could obviously use filters but this would take away from the autonomy of the report.
Any suggestions would be greatly appreciated!
Best Answer
-
I would probably create a Beast Mode to find the '12 months ago' data, and use that as a filter on my card so that I'm only showing that data.
I don't know the fields in your data, but it would probably look like:
case when date_sub(date_format(current_date(), '%Y-%m-01'), interval 12 month) = date_format(your_date_field, '%Y-%m-01') then 'Y' else 'N' end
When you drag that to your filter and choose 'Y', the pie chart should only show data from 12 months ago, and will move to the new '12 months ago' every month.
1
Answers
-
I would probably create a Beast Mode to find the '12 months ago' data, and use that as a filter on my card so that I'm only showing that data.
I don't know the fields in your data, but it would probably look like:
case when date_sub(date_format(current_date(), '%Y-%m-01'), interval 12 month) = date_format(your_date_field, '%Y-%m-01') then 'Y' else 'N' end
When you drag that to your filter and choose 'Y', the pie chart should only show data from 12 months ago, and will move to the new '12 months ago' every month.
1 -
Hi Sean,
This worked perfectly, thanks!
1 -
You can have a bit more flexibility if you restructure your data using a date dimension table with custom offsets so you can then filter on any time frame and get the 12 months ago for the exact same timeframe instead of just the current timeframe. I've done some write-ups in the past about how to get this configured and setup with code examples. Feel free to take a look:
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 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