Creating Date Field

Hello,

I have two fields coming from the dataset
i.e. month and year
month are 01,02,03…11,12 (MM)
Year is 2022, 2023 and so on (YYYY)

I am planning to create concatenated date field
MM-YYYY in QuickSight (Dropdown : Multiselect)
I tried using concat(month,‘-’, year). However, the quicksight throws an error without much explanation. I am assuming this is due to the data types for month and year respectively OR do I need to create a parameter?

image

Can you please help me resolve the issue with relevant steps?

Thanks in advance!

@Ajinkya_Bangale - Please ensure that both of your Month and Year Datatypes are string. If not, you need to cast them to string before you can do the concatenation operation. If you have your Order Year and Order Month is integer datatype, the below expression can be used to get the desired format that you are looking for. Hope this helps!

concat(right(concat(“00”, tostring({Order Month)), 2), " - ", tostring({Order Year}))

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!

3 Likes