Reputation: 3
Is there a way to get Tableau to recognize generic days as a time series?
I have scientific data that involves measurements taken over twelve days. It doesn't matter what those actual dates are - I don't know if it was January or October, last month or five years ago. What matters is seeing them in order from Day 1, Day 2, Day 3, and being able to use time series functionality like animation and such. My gut instinct is to give it fake dates like January 1, 2018, January 2, etc and then change the alias, but is there a more elegant solution?
Example:
Sample A
Day 1: 80
Day 2: 116
Day 3: 152
Sample B
Day 1: 30
Day 2: 65
Day 3: 189
Sample C
Day 1: 45
Day 2: 103
Day 3: 162
Upvotes: 0
Views: 212
Reputation: 678
If it's true that the actual date doesn't matter, then the best thing to do would treat your days as a series of numbers on a timeline. Afterall, that's what Tableau does with dates. Of course, Tableau's treatment of dates isn't that simple, but for this example, we can simply treat our dates as numbers.
I went ahead and create a small data set to simulate your scenario.
In order to get the split the number out of our [day] column, we use Tableau's SPLIT function.
The delimiter is a space or " " and we want the second value returned from the split. We also want this to be an Integer, so we wrap the whole function in the INT function.
Finally, you'll be able to see those values spread across your days.
By adding our new [Day Number] to the filter you can use the slider to be selective with the days you display.
Upvotes: 1
Reputation: 3348
I'm assuming your Dimension of Days contains values like "Day 1", "Day 2", etc.
You can create a calculated field as follows:
case [Day]
WHEN "Day 1" THEN #2018-01-01#
WHEN "Day 2" THEN #2018-01-02#
WHEN "Day 3" THEN #2018-01-03#
WHEN "Day 4" THEN #2018-01-04#
WHEN "Day 5" THEN #2018-01-05#
WHEN "Day 6" THEN #2018-01-06#
WHEN "Day 7" THEN #2018-01-07#
WHEN "Day 8" THEN #2018-01-08#
WHEN "Day 9" THEN #2018-01-09#
WHEN "Day 10" THEN #2018-01-10#
WHEN "Day 11" THEN #2018-01-11#
WHEN "Day 12" THEN #2018-01-12#
end
Tableau uses the # around text to convert the value to a Date type.
Result:
Upvotes: 0