Re: Period over Period using stacked bars
I was looking to add an extra layer of granularity to my period over period chart. Basically I want to combine a Year over Year card, and a stacked bar so we can quickly see that the balance between the two components isn't changing. With this chart I'm just looking to see the quantities, and I'm not going to be digging into variance YoY.
Thanks for the help on this!
Comments
-
So if you're wanting to do comparison between objects over the same timescale (ie, YoY by month) I would personally use something like a grouped bar instead of stacked. I think it's a bit easier to tell if there is a difference between values.
Here's how I would tackle it:
1.) Create a Monthname beastmode to return on the month name (this will be your X-axis)
MONTHNAME(`Date`)
2.) Create a Date Orderer beastmode so that it orders your month names correctly and drop this into your sorting field
CASE WHEN MONTH(CURDATE()) = MONTH(`Date`) THEN 1
WHEN MONTH(DATE_SUB(CURDATE(), interval 1 MONTH)) = MONTH(`Date`) THEN 2
WHEN MONTH(DATE_SUB(CURDATE(), interval 2 MONTH)) = MONTH(`Date`) THEN 3
WHEN MONTH(DATE_SUB(CURDATE(), interval 3 MONTH)) = MONTH(`Date`) THEN 4
WHEN MONTH(DATE_SUB(CURDATE(), interval 4 MONTH)) = MONTH(`Date`) THEN 5
WHEN MONTH(DATE_SUB(CURDATE(), interval 5 MONTH)) = MONTH(`Date`) THEN 6
WHEN MONTH(DATE_SUB(CURDATE(), interval 6 MONTH)) = MONTH(`Date`) THEN 7
WHEN MONTH(DATE_SUB(CURDATE(), interval 7 MONTH)) = MONTH(`Date`) THEN 8
WHEN MONTH(DATE_SUB(CURDATE(), interval 8 MONTH)) = MONTH(`Date`) THEN 9
WHEN MONTH(DATE_SUB(CURDATE(), interval 9 MONTH)) = MONTH(`Date`) THEN 10
WHEN MONTH(DATE_SUB(CURDATE(), interval 10 MONTH)) = MONTH(`Date`) THEN 11
WHEN MONTH(DATE_SUB(CURDATE(), interval 11 MONTH)) = MONTH(`Date`) THEN 12
END3. Now you will create each of the "bars" of your graph. If you're just doing a count on current year vs previous year...
Current Year
COUNT(CASE WHEN `Date` IS NOT NULL AND and `Date` >= DATE_SUB(DATE_FORMAT(CURDATE(), '%Y-%m-01'),interval 11 month) THEN `ItemNumber`
END)
Previous Year
COUNT(CASE WHEN
`Date` <= LAST_DAY(DATE_SUB(CURDATE(), interval 12 month))
AND
`Date` >= DATE_SUB(DATE_FORMAT(CURDATE(), '%Y-%m-01'), interval 23 month)
THEN
`ItemNum`END)
Once those are done, your Axis option should look like the following:
From this point you can modify/add additional columns where you edit your Case statements to limit by specific items you want to compare (ie, AND `itemtype` = 'A')
Hopefully this will get you on started on the right track. Let me know if you have any other 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
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