Hi,
I have a column named YEAR that is coming in as "Double" Column type. I need to convert it to a Calendar year column type. So far I have used this formula:
But I am receiving an error.
Please assist, thank you,
Adam
Solved! Go to Solution.
Hi @Adam_B
A small change to your formula: DateTimeParse(ToString([Year]),"%Y") let me know if it works.
I am getting this error
Ah I see. Creating new column in Formula tool should fix this!
@Adam_B When you take the parts of the date it will be always numeric. I mean if you have the [Year] field in numeric type (double or int) that is correct. Is there any reason why you are changing your [Year] field to Calendar Year? If you convert the given year into a calendar year also you will get the same numeric data type
@binuacs I have an excel xlsx file coming in with YEAR as the whole year (ex. 2023), Alteryx is showing it as Double, which in turn when I attach my data source to Tableau, it sees it as a string, I need it as a calendar year.
This formula still provides the whole date as ,
I just need the year.
@Adam_B you missed the DateTimeYear() function, can you update your formula like the below highlighted in yellow?
DateTimeYear(DateTimeParse(ToString([Year])+'0101','%Y%m%d'))
@binuacs Thank you...again :)