2

enter image description here I am working about the Higher Education data in Tableau. Specifically, I am aiming to create a line graph where the x-axis showcases academic years in the format "YYYY/YY" (for example: 2020/21, 2021/22, 2022/23, and so on). The y-axis will represent the number of students.

However, I encountered a challenge: the academic year format in my data is currently stored as a string. Consequently, this format is not compatible with Tableau's line chart functionality. I did attempt to work around this issue by creating a new column to represent the year (2020, 2021, etc.), which enabled the graph to function as intended. However, the x-axis labels were not in the desired "YYYY/YY" format.

I am reaching out to seek your advice and recommendations on how I can achieve a line graph that accurately represents academic years in the "YYYY/YY" format on the x-axis. I greatly appreciate any insights or solutions you can provide.

Thank you so much for your time and assistance. I look forward to hearing your suggestions.

Best regards, Kawwalin

Kathie K
  • 35
  • 4
  • You might need to use a dashboard instead of a worksheet, so you can jury rig an 'axis' above what you currently have. I don't think custom date formats will help unfortunately. If you do find a solution I recommend answering your own question, I'm sure others have run into this problem before. – sanminchui Aug 08 '23 at 17:36

1 Answers1

0

You can create a calculated field called, say, School Year, defined as

IF MONTH([Date]) >= 8 THEN
  STR(YEAR([Date])) + "-" + RIGHT(STR(YEAR([Date]) + 1), 2)
ELSE
  STR(YEAR([Date]) - 1) + "-" + RIGHT(STR(YEAR([Date])), 2)
END

This record level calc will map the Date of each record to the corresponding school year, much like a fiscal year, formatted similar to how you requested. (The function RIGHT() reduces clutter by just picking off the last two digits of the spring year.

I arbitrarily chose August as the boundary between school years. You can obviously pick a different dividing point, or another rule for determining the school year.

Then just use the School Year instead of Date for your visualizations. The School Year field has the data type String.

Strings are always discrete, so you will get individual columns instead of a horizontal axis when you put School Year on the Columns shelf. By default, you will then get bar charts instead of lines, but just change the mark type to Lines if you wish.

So you can see the impact of when your neighbors' kids enter and exit the school system as below :-) enter image description here

Alex Blakemore
  • 11,301
  • 2
  • 26
  • 49