How to convert days ex Monday Tuesday etc in string data type to day type in Tableau

0 votes
I have a column called "Day of Week" that has information on the days of the week, such as "Monday," "Tuesday," "Wednesday," and so on. It always appears as string data type when I import it into Tableau. In order to conduct time series modelling, I need to change it to a day data type under Datetype. However, when I used the DATEPARSE method to convert a string to date format, it failed every time.

DATEPARSE('MMM',[Day of Week]) DATEPARSE('EE,EEEE','Day of Week'])

Could someone please assist me? Is there anything I'm missing?
Apr 4 in Tableau by Vaani
• 7,020 points
55 views

1 answer to this question.

0 votes
To create a date from constituent integers, use MAKEDATE.

With: Y,M,D as 2020,8,25

the date is created as MAKEDATE([Y],[M],[D])

The string day is not sufficient for the date calculation because there are several e,g, Mondays each month. You need the day of the month.

That said, if you do want to convert the string day to an integer, it can be done using CASE, as follows, where day is the string day:

CASE [Day] WHEN 'Sunday' THEN INT(1) WHEN 'Monday' THEN INT(2) WHEN 'Tuesday' THEN INT(3) WHEN 'Wednesday' THEN INT(4) WHEN 'Thursday' THEN INT(5) WHEN 'Friday' THEN INT(6) WHEN 'Saturday' THEN INT(7) END
answered Apr 5 by Neha
• 8,740 points

Related Questions In Tableau

0 votes
1 answer

How to convert string to date format in Tableau?

You can create the following calculated field: Dateparse('EEE ...READ MORE

answered Jun 30, 2018 in Tableau by sdfg
• 5,550 points
5,118 views
0 votes
1 answer

How to refresh the extracted data source automatically in Tableau Desktop?

Hi AwesomeSauce, This comes up every so often!  Tableau ...READ MORE

answered Aug 14, 2018 in Tableau by Naruto
• 710 points
3,704 views
0 votes
1 answer

How to display days data based on date selected in the filter by the user.

You can create a parameter for dates. Select data ...READ MORE

answered Aug 15, 2018 in Tableau by AwesomeSauce
• 860 points
855 views
0 votes
1 answer

In Tableau, How to sum the last 7 days of the value?

It can be achieved easily by creating ...READ MORE

answered Mar 12, 2019 in Tableau by Cherukuri
• 33,010 points
12,833 views
0 votes
1 answer

Find length of string in R

You can try nchar > nchar("fast") [1] 4 > set.seed(10) > ...READ MORE

answered Apr 17, 2018 in Data Analytics by DataKing99
• 8,240 points
261 views
0 votes
1 answer

Removing all white-spaces from a string

You can use the 'str_replace_all()' function from ...READ MORE

answered May 16, 2018 in Data Analytics by Bharani
• 4,660 points
204 views
0 votes
1 answer

Converting a string to title case - R

library(tools) toTitleCase("this is sparta") [1] "this is Sparta" ...READ MORE

answered May 19, 2018 in Data Analytics by Bharani
• 4,660 points
910 views
0 votes
1 answer

How can two strings be concatenated in java?

You can concatenate Strings using the + operator: System.out.println("Your number ...READ MORE

answered Jun 6, 2018 in Java by Daisy
• 8,120 points
222 views
0 votes
1 answer

How to upload data to Tableau Server in Python

https://www.tableautim.com/playlist-video/tableau-tds-and-tdsx-files/csv-to-tdsx Then install the tableau-api-lib utility for Python ...READ MORE

answered Mar 4 in Tableau by Neha
• 8,740 points
261 views
0 votes
1 answer

Convert String to Date in Tableau using DATEPARSE

You should be able to make the ...READ MORE

answered Mar 28 in Tableau by Neha
• 8,740 points
317 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP