0
votes

I'm trying to create a time series / line graph in Tableau Public. The imported excel file lists individual years as the variables/headers. The values are numeric/counts. The year is being picked up as categorical and so will only let me create bar charts ( and not line graphs).
How can I get the year to be picked up as a date in Tableau?

https://public.tableau.com/profile/kerr.mcintosh#!/vizhome/DateSeriesLineGraph/Sheet1

Excel Spreadsheet Screenshot Tableau Screenshot

3
can you link your data source? you need to pivot it so all years are in one column. then that column can be made as a date type field.Bernardo
Many thanks for reply - I've added link to my public tableau public.tableau.com/profile/kerr.mcintosh#!/vizhome/…Kerr McIntosh

3 Answers

1
votes

You need to understand two things. Variable name and variable values are different things. You don't have any year or date value in your data instead. What you have is years stored as variable or column names instead of having them as values. Moreover what is stored under each variable (read column) is some other measure.

If I am able to put it correctly, you have data reshaping problems. Values should never be stored as column names. What is correct is that year should be column names and its values like 2018 2019 etc should have been stored in that column.

Now proceed like this, click all year columns in data pane/window and click pivot. This will result in a longer data with two columns in lieu of all year columns - pivot col names and pivot values. Rename first one as year. Second one as metric. Now you can create a calculate field on year column. This will result in creation of a date field as desired.

If you are still unable to do it, upload your excel/csv file on a drive and paste a link, i will demonstrate you.

Good luck

P.s. transposing your data in Excel itself may solve your problem directly, if you can do it.

1
votes

Change your data to this structure. Google Tableau excel add on tool for an excel add on that does this.

enter image description here

Make a Date calculated field.

enter image description here

Result:

enter image description here

files: https://www.dropbox.com/s/do59sbu8kvhkufd/Date%20Series%20Line%20Graph.twbx?dl=0 https://www.dropbox.com/s/j15mhrlyz19l7kq/20201106_so_question.xlsx?dl=0

0
votes

If I have understood your question correctly, you don't want to see the years in the YYYY format, instead you want the DDMMYYY (or similar). Generally, if all the years are in one field and you want the dates, you can just right click on the field and click on "Exact Date" Option and you will get the dates. Can you try something similar in your scenario. It would be really helpful if you could share the Tableau Public Link of your report.

Regards, Sneha Shreedhar