YoY YTD Comparison
I am trying to build a chart that compares YoY growth across cities. X axis would be the city, primary Y axis would be revenue, secondary Y axis would be % change, and the series(grouped bar) would be YTD revenue, and Prior Year YTD revenue.
I can't seem to do this in the YoY charts because I need to show the cities on the X axis. It seems I need the proper BeastMode calculations to set this up. Can someone point me to a way to calculate current year YTD revenue, PY YTD revenue, and the % change between those two? Full year does not work because is not an apples to apples comparison as 2018 has just started.
The attached screenshot is a general idea of how I'm trying to organize the data.
Thank you!
Comments
-
Here's a link where I explained how to do this for someone else (except instead of Cities, we used MonthNames as the X axis). You should be able to skip that part but the year over year beastmodes should still apply.
https://dojo.domo.com/t5/Card-Building/Re-Period-over-Period-using-stacked-bars/m-p/30479#M3655
Let me know if you have any questions.
Sincerely,
ValiantSpur
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.0 -
Forgot to add, the formula for % change is just a combination of the two year beastmodes.
Something like this:(Current Year BeastMode / Previous Year BeastMode) - 1
And if you're only showing YTD, then just set the Date Range to Year to Date.
Hope this helps
0 -
Thanks for the quick response! As of now I am getting a syntax error on the CY BeastMode with '%Y-%m-01' highlighted in red.
0 -
So you're wanting to compare this year to date vs last year to date, is that correct?
Also, was is the name of your date field? And are you going to be counting or summing your value field?
If I know the names of those fields, I'll just write it up for you real quick
0 -
Exactly.
As of 2/8/18 there is $X in revenue as one bar in the stack. As of 2/8/17 there was $X revenue as one bar in the stack. Grouped by city and summing the number.
The date field is 'close date' and the $ field is just 'revenue'.
I stumbled upon this as a PY solution:
SUM(CASE WHEN `Close Date` <= DATE_SUB(CURDATE(),INTERVAL 1 YEAR) THEN `Revenue` END)
0 -
Here you go:
Prior Year:
SUM(CASE WHEN `Close Date` <= DATE_SUB(CURDATE(),INTERVAL 1 YEAR) AND `Close Date` >= DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 YEAR), '%Y-01-01')
THEN `Revenue` END)Current Year:
SUM(CASE WHEN `Close Date` >= DATE_FORMAT(CURDATE(), '%Y-01-01')
THEN `Revenue` END)Variance:
(SUM(CASE WHEN `Close Date` >= DATE_FORMAT(CURDATE(), '%Y-01-01')
THEN `Revenue` END)
/
SUM(CASE WHEN `Close Date` <= DATE_SUB(CURDATE(),INTERVAL 1 YEAR) AND `Close Date` >= DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 YEAR), '%Y-01-01')
THEN `Revenue` END)
)
- 1And then just use your city field as the X axis. Let me know if you have any issues.
0 -
We look at a ton of YOY comparisons. The best way we have found is in the dataflow(SQL or Redshift) we have columns for "current year sales" and "py sales" then we create a beastmode like sum(cy sales)-sum(py sales) or for the % (sum(cy sales)-sum(py sales))/sum(py sales).
That approach allows you to throw anything on the axis and the beastmode will calculate
1
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