formatDate() doesn't work when a format is supplied

I’m running into an issue when using the formatDate() function in a calculated field. When I have it defined as formatDate(now()) then it works fine and outputs into a table visual.

However, when it’s defined as formatDate(now(), 'yyyy/dd/MM' ) then it shows an error:

Am I using this function incorrectly?

3 Likes

Hey @maat, what is the datasource you are using for your dataset? There are limitations to the format depending on the location of the source data.

Also, the formatDate value returns a string value. What if you tried changing the format in the field inside of the analysis. My response on this post provides an example of that: How do I change the date format displayed on a visual's axis in Amazon QuickSight? - #2 by DylanMorozowski

Last thing, if you look through the documentation for parseDate, you can see the date formats available depending on the datasource you are using.

Let me know if this helps!

3 Likes

Is my datasource relevant for this issue though? I’m using the function now() in the calculated field so I can’t imagine why the data source/set is relevant.

1 Like

Hello @maat, I know you are using now(), but I am pretty sure the datasource is still relevant. The calculated field is on the dataset, so it will follow the same rules. Have you tried just changing the format from the field well instead of the calculated field?