**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.

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**. - Then the Connect page will open, click on
**Microsoft Excel.** - Navigate to the downloaded files, select
**Sample Superstore**excel file, which is a saved excel file, and click on Open. - 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**. - The
**Sample Superstore**excel file contains the below details. - 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.

- By dragging

- Navigate to the
**Analytics Tab**in the Tableau. You can see a**Trend Line**option under**Model.** - Drag the
**Trend Line**option to the visualization area, you will find the five different trend line options as shown below. - 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.

- 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**.

- 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. - 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. - 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. - 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. - In the same, if you select Describe Trend Line Model: this option gives you the description of the entire trend line model.

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

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.

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.

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

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:

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.

The description of the polynomial trend line is as below:

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.

The below image shows the description of the **Power Trend Line**

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.