DEV Community

Sneha Ashok Naik
Sneha Ashok Naik

Posted on

Tableau: Normalising Dates for time series alignment

This is an attempt to document learnings as regularly as possible.

Today, I'd like to discuss Normalising Dates to align your time series graph.

The example for today is a list of Companies since the 1960s till the present day with their adjusted closing price.

Default View

alt text for accessibilityWhen you drag Date(year) to columns, Adjusted closing price to rows and company in the detail shelf, tableau and select the time series graph you'd have a graph that look's like the screenshot above.Now, if you want to create a graph that aligns all the companies start date to the same date below are the steps.

Normalized View

alt text for accessibility
a. Find the min. Date for each company using LOD.
formula : {FIXED [Company] : min(Date-Year)}
b. Find the min. Date for entire data set using LOD.
formula : {min(Date-Year)}
c. Find the difference of year b/w step a. and b.
Let's call this Diff. Years
d. Use 'Diff. Years' from Step c to adjust Company dates.
formula : [Date-Year] - Diff. Years
Let's call this Normalised Dates
e. Drag Normalised Dates to Columns, Adjusted Closing Price to rows and Company to detail shelf.

Do let me know your thoughts/questions/suggestions. I'd be happy to listen to them.

Top comments (0)