6 Replies Latest reply on Jun 6, 2019 12:36 PM by Ron Chipman

# 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

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

Hi Briann,

Glad to see you were getting something to work.  I have a question, that apparently is so simple, it is glassed over by all knowledge articles as they dive into the deep stats around it.

When you say you set X = 'dates', how are you representing that numerically?  I have a trend model equation :  ln(per min concurrency) = -13.2465*(Minute(CreateDate)) + 577823, but I'm not sure what values I can actually insert to represent (June 7th @ 12:30 PM).  Do we use unixtime?  Something else?  How do I translate minutes into a generic number in such a way that I can use it in the formula?

Thanks!

Ron