Override axis date for chart with 2 different date fields
Hi,
I am trying to make a chart that shows how many orders were opened and how many were closed per month on the same chart. Orders that have been opened and closed should show twice on the chart. Once in the month they opened & once in the month they closed.
The dataset looks like this, where the open and closed dates exist on the same row. What can I use for the X axis that will have both fields accurately applied per month? If I choose one, then the other date is incorrect. A beastmode of the 2 does not work either.
Any help is greatly appreciated. :)
Answers
-
You can leave the start date as your x-axis, but you need to change how you count your open and closed dates. I would create a beast mode for open and one for closed. They would look like this:
Open
CASE WHEN LAST_DAY(startdate) = LAST_DAY(openeddate) THEN 1 ELSE 0 END
Closed
CASE WHEN LAST_DAY(startdate) = LAST_DAY(closeddate) THEN 1 ELSE 0 END
The LAST_DAY() function is a handy function that will allow you to see if two dates are in the same month because it will change the date to the last day of the month
You can drag each of the fields into your y-axis and series and choose Sum and you should get the appropriate totals you are looking for.
Hope this helps.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Hi @MarkSnodgrass ,
Thank you very much for your reply. It is not responding the way I had hoped. The numbers look further off than before.
Sorry, but I grabbed a misleading portion of the dataset. The Start date, the Opened date, and the Closed date can be any combination of months. Same month, different months, or even roll over to the next year. And the difference between the start date and the closed date can be more than the 6 months in the chart.
Instead of using the start date, is there a way to create a "neutral" date between the opened and closed dates?
0 -
0
-
Because of how Domo interprets your data on a row by row basis you'd need to have a record for every day (or month depending on how granular you want to get with your data). You can do this in an ETL. MySQL would logically be simpler because you can do conditional joins but MagicETL may be quicker.
To start you need a date dimension dataset. Domo provides one in the Domo Dimensions connector (calendar.csv).
MySQL:
select `Started`, COUNT(cdo.`dt`) as opened, COUNT(cdc.`dt`) as closed FROM `my_dataset` ds left JOIN `calendar_dates` cdo on cdo.`dt` BETWEEN ds.`Started` and ds.`Opened Date` left JOIN `calendar_dates` cdc on cdc.`dt` BETWEEN ds.`Started` and ds.`Closed Date`
MagicETL:
Gets quite a bit hairy because you need to go a giant cartesian join twice and then do your filtering twice (open date and closed date). I'd recommend trying MySQL first and if you're having issues then move to Magic.
**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
- 58 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