Hello,
I have built a Date Parameter for my dashboard. Currently, it’s in STRING format but I want to convert it in the date format. I used parseDate function to convert into the date format but I am getting the below error. Can you please help in resolving this error? Thanks!
Hi @saljain - Welcome to AWS QuickSight community and thanks for posting the question. Can you please share the sample data and expected output. This will help in guiding the right solution.
Regards - Sanjeeb
Thank you for your reply!
Please refer to that attached screenshot for the sample data and expected output. The goal is to create a date parameter for weekly, monthly, quarterly, yearly view. For eg: When the user selects Monthly, the dashboard view is updated to show month level data. Currently, the problem is with this date parameter, the date field that I have built is in string format and I want it in the date format. I am using parsedate function but getting error as stated. Please let em know if you have any questions. Thanks!
Hi I have it in this format only. In my case i just have one condition
ifelse(${Date}=‘Weekly’, parseDate(toString({date_week}),“YYYY-MM-DD”),
${Date}=‘Monthly’, parseDate(toString({date_month}),“YYYY-MM-DD”),
${Date}=‘Quarterly’, parseDate(toString({date_quarter}),“YYYY-MM-DD”),
${Date}=‘Yearly’, parseDate(toString({date_year}),“YYYY-MM-DD”), “”)
Hi @saljain - Can you please replace the parsedate part by the below details.
parseDate(substring({date_week},1,10),'YYYY-MM-DD')
Hi @saljain - Ok, in your original formula can you replace default value (“”) to parseDate(“”)
Regards - Sanjeeb
Please look at my previous post. You cannot us ifelse() the way you have done. you need to use nested ifelse() functions to accomplish what you are trying to do.
Hi @saljain - I test with one ifelse and it worked… see the screenshot.
See the data below
Can you try the below code
ifelse({Date} = 'Weekly',parseDate(substring({date_week},1,10),'yyyy-MM-dd'),parseDate(''))
Regards - Sanjeeb