How to properly create future date timeline
Hey Everyone,
So I'm trying to create a visualization of future values based on a selected month. The start month is Feb 2019 and the timeline will go to Feb 2020. My date column from the dataset doesn't go past the current date so I created a calculated field to get the next 365 days:
DATE_ADD(`Date`, 365)
Then, just to make sure it was working, I put my start month calculated field which looks like this:
CASE WHEN MONTH(`Date`) = 2 AND YEAR(`Date`) = 2019 THEN SUM(`VALUES`) END
into the analyzer along with the future dates and got this:
The start month value is now populating in Feb 2020 and not Feb 2019. Just to double check, I replaced the Future dates with just the normal Dates field and the Start column populated the correct month and year. How do I fix this?
Thanks!
Best Answer
-
The trick here is that you updated existing data instead of adding future data.
The Short Answer:
You'll have to add values for dates in the future using a dataflow or other data prep process.
The Long Answer:
Here is a few sample rows of data
Date Values
1/1/2019 10
2/1/2019 20
3/1/2019 30Here it is with a new Beastmode:
Add_Year = DATE_ADD(`Date`, 365)
Date Values Add_Year
1/1/2019 10 1/1/2020
2/1/2019 20 2/1/2020
3/1/2019 30 3/1/2020Here it is with the second beastmode:
Values_2019 = SUM(CASE WHEN MONTH(`Date`) = 2 AND YEAR(`Date`) = 2019 THEN `VALUES` END)
Date Values Add_Year Values_2019
1/1/2019 10 1/1/2020 0
2/1/2019 20 2/1/2020 20
3/1/2019 30 3/1/2020 0
###########
SIDE NOTE: I made an adjustment for a common error that can cause you grief:
You should put the case statement inside the SUM() rather than the SUM() inside the case.
So this is dangerous and will miscalculate...
CASE WHEN MONTH(`Date`) = 2 AND YEAR(`Date`) = 2019 THEN SUM(`VALUES`) END
And it should be this...
SUM(CASE WHEN MONTH(`Date`) = 2 AND YEAR(`Date`) = 2019 THEN `VALUES` END)Finally the result is that the "Add_Year" beastmode has just shifted your data, not created new placeholders for future data. Then by using the original `Date` field in the calculation you only SUM() the values originally associated with Feb 2019.
Beastmodes cannot create data that isn't in the dataset, only manipulate existing rows of data.
You have to add the future dates to the underlying dataset.
**Say "Thanks" by clicking the "heart" in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1
Answers
-
The trick here is that you updated existing data instead of adding future data.
The Short Answer:
You'll have to add values for dates in the future using a dataflow or other data prep process.
The Long Answer:
Here is a few sample rows of data
Date Values
1/1/2019 10
2/1/2019 20
3/1/2019 30Here it is with a new Beastmode:
Add_Year = DATE_ADD(`Date`, 365)
Date Values Add_Year
1/1/2019 10 1/1/2020
2/1/2019 20 2/1/2020
3/1/2019 30 3/1/2020Here it is with the second beastmode:
Values_2019 = SUM(CASE WHEN MONTH(`Date`) = 2 AND YEAR(`Date`) = 2019 THEN `VALUES` END)
Date Values Add_Year Values_2019
1/1/2019 10 1/1/2020 0
2/1/2019 20 2/1/2020 20
3/1/2019 30 3/1/2020 0
###########
SIDE NOTE: I made an adjustment for a common error that can cause you grief:
You should put the case statement inside the SUM() rather than the SUM() inside the case.
So this is dangerous and will miscalculate...
CASE WHEN MONTH(`Date`) = 2 AND YEAR(`Date`) = 2019 THEN SUM(`VALUES`) END
And it should be this...
SUM(CASE WHEN MONTH(`Date`) = 2 AND YEAR(`Date`) = 2019 THEN `VALUES` END)Finally the result is that the "Add_Year" beastmode has just shifted your data, not created new placeholders for future data. Then by using the original `Date` field in the calculation you only SUM() the values originally associated with Feb 2019.
Beastmodes cannot create data that isn't in the dataset, only manipulate existing rows of data.
You have to add the future dates to the underlying dataset.
**Say "Thanks" by clicking the "heart" in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1
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