Does QuickSight support fixed values for X-axis?

Context

  • Fixed values from 1 to 24 (hours of day) // Currently I don’t know how to implement this
  • My dataset has a timestamp field, and I created a calculated field that extracts the hour from that field (Eg., YYYY-MM-DD 20:mm:ss → hour_of_day = 20) named hour_of_day

Expected

  • Visual in a vertical bar chart
  • X-axis: fixed value from 1 to 24
  • Y-axis: total records by grouping hour_of_day

Currently, I set hour_of_day to x-axis but data is log-like so hour_of_day might not enough value from 1~24

How can I implement this in QuickSight?

Thanks!

Reference

Hi @tobinguyen

do I get you right. The issue is that not every hour is represented in your data and you want to make sure there is always every hour represented in the chart from 1-24?

One solution is to join a table that contains all hours from 1-24 (eg. in a csv file).
You need a simple table with each hour. Then you right join the table in your dataset using your calculated field and the column with the hours in your csv.

Best regards,
Nico

If this helped you, please mark my answer as solution. That helpes the community to find solutions faster.

1 Like

@Nico I have tried CSV solution but my dataset is from an S3 datasource and I still don’t know how to use custom query to format timestamp to hour of day. I tried to join my record dataset with that csv dataset but my calculated field is not in joining field dropdown

@tobinguyen I guess you created the calculated field in the analysis. It is also possible to add a calc field In the dataset pane. Then you should find it as joining field.

Best regards,
Nico

@Nico my calculated field is in the dataset field but when I set the join clause all calculated fields aren’t showing up

Calculated field is in dataset fields

But not shown in the join clause

I found this Q&A that said is not possible to join using calculated field

Hi @tobinguyen

You can come up with your 24 hours as fixed values and map your dataset values into each bucket from your dattaset values field using this video from @DylanM

Regards,
Giri

1 Like

@Giridhar.Prabhu Thanks, I’ll check out this video

@Giridhar.Prabhu I watched the video and tried it, but it doesn’t seem to work in my case (or maybe I did it wrong, sorry I’m very new to QuickSight). This is an example of my dataset, which only has two columns, and I need to count the number of userIDs at each time point during the day. In the case where there is only one record on that day, my rank would only be 1.

User ID Logged At
1 2025-01-01 14:40:12
1 2025-01-02 14:40:12
1 2025-01-02 10:00:00

The chart should be: header is X-axis and row is values

1 2…9 10 11…13 14 15…23 24
0 0 1 0 2 0 0

Hello @tobinguyen, here is an analysis that includes the calculated fields I created in the video that was linked:
Advanced Calculated Fields

This should help you create the static 1-24 hours that you want in your visual.

Hi @DylanM Sorry for the late reply, I was busy and off for a while.

First, thanks for your video and response. But I have a few questions and would appreciate your help.

  • I see that in your example, you’re using denseRank and then grouping the results into three groups. In my case, if there are fewer than 24 records but I still need to display the full range from 1 to 24, how should I handle that?

Hi @tobinguyen,
It’s been awhile since last communication took place on this thread, did you have any additional questions or were you able to find a work around for your last question in the mean time?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @tobinguyen,
Since we have not heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.

Thank you!