I have a purchase database which contains the following data:
Date
Purchase
Hour of the day (I am using the extract formula in my workflow to extract the hour (0-23) from the date field and storing it as a number).
Now, I want to create a vertical chart that shows the number of purchase counts for each hour of the day:
For this, on the Y-axis, I am doing a search for “purchase,” grouping the data by the hour of the day field. The type of grouping is exact, and the aggregation is ‘count.’
For the X-axis, I am again doing a search for “purchase,” grouping the data by the hour of the day field. The type of grouping is exact, and the aggregation is ‘count.’ This time, I am plotting the hours of the day formatted as numbers.
You should generate a list of numbers 0-23 and use that for your X-axis. You can use a plugin or JS to do that.
Depending on what you are using to create the graph, that may not even be necessary, as some graph elements have the option to exclude/include empty values (aka hours for which there are no purchases.)
Btw, you don’t really need to extract the hour from the date and save it separately. You can probably group on the date/time field directly. That also solves your formatting problem, which would just give you all the date/time formatting options that are already available.
With the option set you should set the field:
Get an option > all Purchase hours > filtered by > This Purchase hour Display converted to number is Input Date Time extract hour…
But thinking about it, I don’t remember why I suggested the Option Set… it could really be done with a number field, and just saving it with the Date vale > extract hour….
I had already tried the second approach, where I just extracted the hour number and stored it as a number field. However, I encountered two issues when plotting it on the graph:
I am unable to display all hours on the chart; it only shows the hours that are stored in the database.
On the X-axis, I want to display times like “1 AM,” “2 AM,” “3 AM,” “4 AM,” and so on. However, with just the number field, it displays as “1,” “2,” “3,” “4,” “5,” etc.