Sorting Dates in Graph Visuals

I have a data set connected to our semantic layer that is a direct query. When i create graph visuals (bar chart, line chart, etc) with date in x-axis. I cannot get the x-axis to sort in chronological order.

The fields are formatted as a date correctly. When I change the visual to a table or a pivot, it does sort the date column correctly.

The query sent to the semantic layer establishes sort order by date.

Does anyone have any experience with this and how to resolve

Hello @egutierrez, welcome to the QuickSight Community!

When you place the date field into your table or pivot table, are you utilizing the feature in the field well to set the sort by date? If it isn’t the first column on that visual, it likely will not do it automatically but may be basing the sort from a different field. Here is some documentation about sorting visuals from AWS to show that process more clearly.

Hi Erica,

Welcome to the QuickSight community. As Dylan recomended, if date field is present on x-axis enable data sort and change sort order as shown in screenshot below.

1 Like

yes - after setting the visual to sort by Date (asc or desc) it still sorts the dates randomly in the x-axis

image

Hi @egutierrez
Can you share your visual definition like @AnwarAli ?
Your report_date is date field?
BR

1 Like

yes it is a date field

Hi @egutierrez,
could you please share a screenshot like AnwarAli did?
Thx.

Hello @egutierrez, also, if you could click that down arrow on ReportDate and hover over the sort feature, a screenshot of that could also be helpful. It will show the exact field type that QuickSight has determined for the field. It will look something like this:
DateSortOptions

1 Like

Sort Feature Setting

Sort Feature Setting (2)

image

ReportDate - formatted as date
image

Hello @egutierrez, maybe it is because you are Aggregating by Day when it looks like your dates are in a Week format. Does it fix your sorting if you make that change?

No aggregating by week does not resolve the issue.

Looks wired. Any chance you can build it in Arena that we can have a look directly?

I cannot publish to arena - the dataset is direct query to our semantic database and contains sensitive data

Hello @egutierrez, I think I figured it out. I believe the issue is your date format. Try using parseDate({date}, ’ MM/dd/yyyy’) and use that in your field well instead. I will mark this as the solution for now, but if this still doesn’t work as you are expecting after this change, I would recommend filing a case with AWS Support where we can dive into the details to help you further. Here are the steps to open a support case.