Dynamic dymension won't enable using date column

I made a calculated field that takes input of user’s choice of X-axis dimension that is saved into a parameter.
This works for several columns, but when I’m adding another column which is Date column I get an error.

This works:
ifelse(${dynamicX}=‘Source’, SOURCE, ${dynamicX}=‘DOS’, ACCOUNT, ${dynamicX}=‘Clinic’, CLINIC, ${dynamicX}=‘Account’, ACCOUNT ,SOURCE)

This doesn’t work:
ifelse(${dynamicX}=‘DOS’,{DOS}, ${dynamicX}=‘Source’, SOURCE, ${dynamicX}=‘DOS’, ACCOUNT, ${dynamicX}=‘Clinic’, CLINIC, ${dynamicX}=‘Account’, ACCOUNT ,SOURCE).

The UX doesn’t imply where or what the syntax error is.
Could you please help?

Thanks

Hi @tomer1 and welcome to the QuickSight community!
It looks like in your second calc. field, you have 2 instances where ${dynamicX}=‘DOS’. I wonder if that is leading to the syntax error?

Yes you’re correct about this typo, I fixed it.
Unfortunately I still get the syntax error specifically while adding this date-type column.

this worked:
ifelse(${dynamicX}=‘Source’, SOURCE,
${dynamicX}=‘Account’, ACCOUNT,
${dynamicX}=‘Clinic’, CLINIC,
${dynamicX}=‘Quarter’, Quarter,
SOURCE)

Can this be solved?

Also related - another angle of this:
One of the options in the dropdown I’m talking about is DOS which hold dates.
I wish to add different granularity options like month, quarter and year without having to make specific calculated field for each one of the option.
I know date granularity is an option as I saw it one the demo central but I wish to extend this feature and to use it in this dynamic parameter dropdown.

@Brett Is this possible?

Hi @tomer1,
You can’t return a different type of field so the error is coming from trying to return a date field. You could try using toString for the quarter portion but it may not return the date in the format you’re looking for.

Hi @tomer1,
It’s been awhile since we last heard from you so following up to see if you had any additional questions?

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

Thank you!

Hi @tomer1,
Since we haven’t 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!