converting a date field from an integer or a string to a date: Tableau Quickvids

preview_player
Показать описание
**won't be needed in future versions (Tableau will automatically convert/ Video done in 9.1)

To convert integer use the following formula:
dateadd('day', int([Date]%100)-1,

(dateadd('month', int(([Date]%10000)/100)-1,

dateadd('year', int([Date]/10000)-1000,#1000-01-01#))))

For a string, use the following:
date(mid([DATE],5,2) + "/" + right([DATE],2) + "/" + left([DATE],4))
Рекомендации по теме
Комментарии
Автор

Thank you!!!! OMG - this was driving me up the wall with Tableau (Converting from Interger)

gdsglobaldatashare
Автор

Thanks for creating this video! It really helps me a lot

SuperJohncena
Автор

Gracias, me has ayudado mucho. Saludos.

Raquell_Quintanilla
Автор

Hi, I am trying to convert my string column that look like: APR 2015 to date.I tried function parsedate but I got 2010 January. I tried LEFT+RIGHT functions but it didn't help. Maybe you can help?

adiparag
Автор

Hey, i need some help :-). In my excel sheet i only have years. How can i convert it to be only a year, and not having months, quarters etc...?!

fairy
Автор

ha ha just spotted that this is for american date format!!

tighthead
Автор

Gang, check out the date functions within the tAbleau calculated fields dialog box.. there's a whole sleeve of functions within the DATA sub-library.. **if you don't see the section with functions on it to the right, click the expand arrow on the right side of the calculation box. There are examples with each function. Too easy.

tableaubrent
Автор

Can you explain why the bit of code that you shared transforms the integer into the date. It's nice to have working code to copy and paste, but I'm trying to work to a point where I can write code like this myself

Barber