5 Replies Latest reply on Jan 11, 2017 2:54 PM by David Kuder

# Trend Line Calculation

Is there a method to capture Trend Line Analysis in to a Custom Calculated Field? My goal is to calculate the value of the trend at a specific point in time.

The attached workbook with sample data shows a milestone trend over time; Bar = Actual, Line  = Projected. It would be ideal to change the color of the Projected line if it is above or below the trend line at 12/31/2012.

Any assistance would be greatly appreciated, Thanks

-Briann

bump

• ###### 2. Re: Trend Line Calculation

My question was answered by Tableau Sales Consultant.

The Trend line metadata is currently not available to the user. You can see the data when right-click on the line and selecting "Describe Trend Line", but results are not available.

My workaround will be to replicate the 'Value' via a Calculated Field and use it to determine EOY projections. Once completed, I will post and share.

-Briann

• ###### 3. Re: Trend Line Calculation

I was able to calculate the metadata needed by using a Linear Regression Analysis formula via SQL, prior to uploading Data in to Tableau.

Using various queries, I shaped my data to where X = 'Dates' and Y = 'Running Sum Total' then applied the formula below

Round((Avg([X]*[Y])-Avg([X])*Avg([Y]))/VarP([X]),6)) AS RegressionCoefficient

A stronger Tableau user could create a calculated field to accomplish the same task; I'm not there yet. Please let me know if someone figures it out, Thanks

-Briann

1 of 1 people found this helpful
• ###### 4. Re: Trend Line Calculation

Hi Briann,

I was just looking for the same answer, and found this Interworks blog article. I thought it might be helpful for you as well. It tells you how to do trend line analysis with Tableau and R.

Lauren

• ###### 5. Re: Trend Line Calculation

Briann,

See if this is what you're looking for:

Best,

David