How to use text value on X axis in visual?

Hello,

While developing a visual, I’m attempting to use a calculated field named DrillDownLevel on the X axis which happens to be a text field. Depending on the drill down type, the calculated field returns the following:

ifelse(${DrillDownLevel} = ‘Year’, toString(formatDate(Date,‘yyyy’)),
ifelse(${DrillDownLevel} = ‘Month’, toString(formatDate(Date,‘MMM’)),
ifelse(${DrillDownLevel} = ‘Week’, toString(formatDate(Date,‘WK’)),
toString(Date)))

When I drag the DrillDownLevel field into the Field Well X axis and try to see what it looks like, it displays the following error:

Is it possible to use a text value on the X axis? If so, may I ask how it can be done?

Thanks!

formatDate function always returns string data type, hence no need to do further toString.

Reference Link: formatDate - Amazon QuickSight

Further to this, I believe formatDate(Date, ‘WK’) is unsupported. I have tried to respond to a similar question in the following thread. Hope this helps!

1 Like

Hope proposed solution resolved the issue. I am marking the reply as “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight CommunityQ&A Forum

Hello @fip2 - Did my suggestion help you in resolving your query? If yes, would request you to mark the post as “Solution”. This will help the community to find guidance and answers to similar question. Thank you!