From the course: Tableau 10 for Data Scientists

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Convert strings to dates

Convert strings to dates - Tableau Tutorial

From the course: Tableau 10 for Data Scientists

Start my 1-month free trial

Convert strings to dates

- [Instructor] In this example, we've connected to the GlobalVehicleSales Excel sheet, which you can find in exercise folder. We take a look at the data. We see that we have the countries, the year, and amount of sales. However, when we import this into Tableau, Tableau recognizes it not as a date but as a string. We can see that because we have the blue Abc next to the year. We'd like to use this as an actual date field. Look what happens if we just change the data type. We change it to Date. Now we'll put Year onto our row. Tableau's now given us a null value. Tableau doesn't know how to convert that string into a year. To do that, we need to use a calculated field. Let's remove that from our row and change it back to be a string. When I do Create, Calculated Field, and we're gonna use the DATEPARSE function. The DATEPARSE function will take a string and a format and convert it into a date that Tableau can then use. We'll give our calculation a name, and we'll do DATEPARSE. I need…

Contents