Tableau Trendlines

A trend line is a line showing the patterns or trends emerging from data points. Trend lines are used to predict the continuation of a certain trend of a variable. It also helps to identify the correlation between two variables by observing the trend in both of them simultaneously.

Trend lines are considered to be of great use in data visualization and analysis. In Tableau, we get a lot of options to create different types of trend lines which helps in inferring important patterns and trends in our data.

Trend lines help us in interpreting data trends, predicting future scenarios, and draw a correlation between two variables in the analysis.

In Tableau, You can have a straight or curved trend line depending on the model you select from the different trend line models available in Tableau.

Tableau has a total of five types of trend lines:

  • Linear trend line
  • Exponential trend line
  • Logarithmic trend line
  • Polynomial trend line
  • Power trend line.

Tableau Workspace and Navigation

Add Trend Line in Tableau

In this section, we are going to learn how to add a trend line to our visualizations/Charts.

  • Open Tableau and click on Connect to Data.
    connect-to-data-tableau
  • Then the Connect page will open, click on Microsoft Excel.
    click-on-connect-to-data-excel-file-tableau
  • Navigate to the downloaded files, select Sample Superstore excel file, which is a saved excel file, and click on Open.
    connect-sample-superstore-to-tableau
  • You can download a Sample Superstore.xls file from the given link: https://chercher.tech/files/
  • Once the data source has been connected, open a new worksheet by clicking on sheet1.
    naviagte-to-sheet1-tableau
  • The Sample Superstore excel file contains the below details.
    sample-superstore-excel-file-tableau
  • Create a scatter plot,
    • By dragging Sales to the column shelf and Profit to the row shelf.
    • Next, drag the Order_date to the color tab and Sub-Category to the details tab on the Marks shelf.
    • Drag the Sum(Sales) to the filter shelf and select the range of values as per your requirement.

scatter-plot-tableau

  • Navigate to the Analytics Tab in the Tableau. You can see a Trend Line option under Model.
    navigate-to-analytics-tab-and-trend-line-tableau
  • Drag the Trend Line option to the visualization area, you will find the five different trend line options as shown below.
    drag-trend-line-option-to-graph-area-tableau
  • Here, I am selecting the Linear Trend line option, after you can see 4 trend lines added to your scatter plot graph as shown below. And each line is of a different color with respect to the year.
    linear-trend-lines-with-year-of-order-date-tableau

Data Sorting in Tableau

Edit Trend Lines in Tableau

  • Tableau provides an option to edit the trend lines individually.
  • Right-click on any of the trend line in the graph area, a pop-up window will open, which is having options called: Describe trend line, Format trend line, Show trend lines, Edit trend lines, and Describe trend model.

trend-line-edit-options-tableau

  • If you select the Describe trend line : This option gives a detailed description of the trend line. It includes the p-value, equation, and coefficients of the trend line as shown below.
    describe-trend-line-option-deatils-tableau
  • If you select Format Trend Line: this option helps you to format the appearance of the trend lines. We can change the line type, thickness, color, etc of the trend line from here. You can explore more formatting options from the formatting pane which appears on the left.
    format-options-in-trend-lines-tableau
  • If you select the Show trend lines: this option shows the trend line on the graph, if you uncheck this option the trend line will disappear from the graph.
    trend-line-disappear-from-graph-tableau
  • If you select Edit trend line: This option is used to change the trend line type from one to another. It also provides a few other editing options.
    edit-trendline-options-tableau
  • In the same, if you select Describe Trend Line Model: this option gives you the description of the entire trend line model.
    detail-description-of-trend-line-model-tableau

Tableau Data Relationship

Types of Trend Lines in Tableau

As I said earlier there are five different trend lines available in Tableau, let us discuss them one by one as below.

Linear Trend Line:

Linear trend lines are used to estimate a linear relationship between the given data. The linear equation is :

Y=β0+β1*X
//**Where Y is the dependent variable that we are interested in and X is the independent variable that affects Y**//

The above formula represents the simplest trend line model, the linear trend line estimates a relationship that is increasing or decreasing at a steady rate β1 and is, therefore, best used when the trend of the data resembles a linear pattern.

Example : The cost of products tends to be linear. If one apple costs $1 then five apples will cost $5.

The below image shows the linear trend line of profit and sales.
linear-trend-line-of-profit-and-sales-tableau

Tableau Dashboards

Exponential Trend Line in Tableau

In the exponential trend line model, the natural log of the data values are taken and then those values are plotted after exponentiating them. The equation of an exponential trend line is:

 Y = exp(b0)* exp(b1 * X).

To change the data values into their natural logs, the equation used is ln(Y) = b0 + b1 * X

The exponential trend line does not accept values less than zero. That is why, while calculating for an exponential trend line, Tableau eliminates all the negative values from the set.

The below image represents the exponential trend line.
exponential-trend-lines-tableau

Right-click on the trend line and select the Describe Trend line option will show you the details of the trend line:
describing-exponential-trend-line-tableau

Tableau Treemap

Logarithmic Trend Line in Tableau

The logarithmic trend lines represent the logarithm values in a data field. The equation of a logarithmic trend line is given as:

Y = b0 + b1 * ln(X).

In order to create a logarithm, Tableau filters out all the negative values, and as the exponential trend line, the logarithm cannot be defined with values less than zero.

The below image shows the algorithm trend line with its description:
algorithm-trend-line-tableau

Bar Chart in Tableau

Polynomial Trend Line in Tableau

Polynomial trend lines are curved lines, which deals with variables with a fluctuating relationship. This is why these trend lines have different shapes depending on the user-defined order of the polynomial.

You can select the degree for the polynomial series between 2 to 8. The accuracy of a polynomial model depends on the values taken and the polynomial degree. You can check for a warning message underlined in red in the description of the model to see if your model is accurate or not.

The equation or formula to create a polynomial trend line is:

Y = b0 + b1 * X + b2 * X^2 + …

The below images shows the polynomial trend line.
polynomial-trend-line-tableau

The description of the polynomial trend line is as below:
polynomial-trend-line-description-tableau

Calculations in Tableau

Power Trend Line in Tableau

Power trend lines are curved lines that are used when the dependent variable increases at a predetermined rate β_1.

Note: Power trend lines are a feature made available in Tableau 10.5, not supported by earlier versions.

The formula or equation for a power trend line is:

Y = b0 * X^b1

In the power model, both variables are transformed by the natural logarithm ln(Y), ln(X) before the model is estimated.

Since these quantities are not defined for negative values, any marks with negative values in either variable will be filtered out. And the power trend lines should be used with caution to avoid information loss.

The below image shows the power trend line.
power-trend-line-tableau

The below image shows the description of the Power Trend Line

poswer-trend-line-description-tableau

Pie Chart in Tableau

Trend Line Assumptions

Whenever you want to create a trend line model in Tableau, the calculations are based on some assumptions. They are known as trend line assumptions. Every trend line is created by doing computations that depend upon these assumptions.

The trend line assumptions are :

  • The model is a functional simplification of the true data generating process and is very accurate.
  • All the errors average to zero. Also, the errors are uncorrelated with the independent variable.
  • The errors have constant variance and they are not correlated with each other.
  • The explanatory variables are not exactly linear functions of each other.
0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions