How to set date x-axis to monthly date range?

Hi all. I am new to Quicksight.

I loaded a basic dataset to my bar graph, where x axis is date and y axis is a numerical value. On default, the x-axis shows all the dates it can output. Below is a sample:

However, I want to limit the x-axis to just the number of days for the current month, and subsequently to only show the number of days based on the month selected in a filter.

For example, if it is Oct 2024, it will only up 1 Oct to 31 Oct.

How can I achieve this in Quicksight? It seems to be an easy problem but I can’t figure it out. Do I have to create a calculated field? Appreciate someone advise and tutorial. Thank you.

Hi @dixerio

You can create a calculated field with your date field (Date), present in your graphic, replacing that date field by day calculated field … like the image.

image

Let me know if that resolves the issue!

Regards, José Burrull

Hi @dixerio ,

Adding to what @jose_burrull has suggested, it works for current month. But if you want to power the range of dates by month selection, you can follow using a filter control for month.

Step 1: Calculation month_start_date for each date_field from your dataset
e.g. : truncDate(‘MM’, date_field)
Step 2: Add month_start_date field created above to the filter for the visual and also add the control. Tune the control format to show month-year.

This will allow the user to choose the month they want to see the trend for.

Thanks,
Prantika

1 Like

@prantika_sinha very well

Thanks both. Do I need to do anything to make the dashboard show the current month data by default upon loading?

Hi @dixerio,
You can create a parameter for each, your start date and end date, then add a control for each and choose your default dates. As you can see below, you can set your defaults to ‘start of’ and ‘end of’ month. Then just add a filter for the visual that’s based on your date parameters and it will always default to that.

Let us know if you have any additional questions, if we do not hear back within the next 3 business days, I’ll go ahead and close out this topic as it seems a solution has been provided!

Thank you!

1 Like

Hi @dixerio,
Since we haven’t heard back, I’ll 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!