**Published:**15 Feb 2017

**Last Modified Date:**25 Apr 2017

### Environment

Tableau Desktop### Answer

Please note that New correlation and covariance functions were added to Tableau Desktop 10.2, for more information see What's new in Tableau Desktop.#### Step 1: Create a scatterplot

This example uses Superstore sample data.- Drag Profit to
**Columns**and Sales to**Rows**. - Drag Customer Name to
**Detail**. - In the
**Analysis**menu, uncheck**Aggregate Measures**. - Right-click the view and choose
**Trend Lines**>**Show Trend Lines**. - Right-click the view again and select
**Trend Lines**>**Describe Trend Model**.

#### Step 2:

#### Option 1: Calculate the correlation

Locate the R-Squared value in the Describe Trend Model dialog box. In this example, the R-Squared value is 0.229503.Using a calculator or other program, calculate the square root of the R-squared value. This is your correlation (r). Rounded to two digits, the value in this example is 0.48.

#### Option 2: New in Tableau 10.2 use one of the built-in functions

**CORR(expression 1, expression 2)**aggregate function

Returns the Pearson correlation coefficient of two expressions. The Pearson correlation measures the linear relationship between two variables. Results range from -1 to +1 inclusive, where 1 denotes an exact positive linear relationship, as when a positive change in one variable implies a positive change of corresponding magnitude in the other, 0 denotes no linear relationship between the variance, and −1 is an exact negative relationship.

**WINDOW_CORR(expression1, expression2, [start, end])**table calculation

### Example

The following formula returns the Pearson correlation of SUM(Profit) and SUM(Sales) from the five previous rows to the current row.

`WINDOW_CORR(SUM[Profit]), SUM([Sales]), -5, 0)`

### Additional Information

alculationA correlation, r, is a single number that represents the degree of relationship between two measures. The correlation coefficient is a value such that -1 <= r <= 1.

A positive correlation indicates a relationship between x and y measures such that as values of x increase, values of y also increase.

A negative correlation indicates the opposite—as values of x increase, values of y decrease.

The closer the correlation, r, is to -1 or 1, the stronger the relationship between x and y.

If r is close to or equal to 0, there is a weak relationship or no relationship between the measures.

As a general rule, you can interpret r values this way:

- +.70 or higher indicates a very strong positive relationship
- +.40 to +.69 indicates a strong positive relationship
- +.20 to +.39 indicates a moderate positive relationship
- -.19 to +.19 indicates no or a weak relationship
- -.20 to -.39 indicates a moderate negative relationship
- -.40 to -.69 indicates a strong negative relationship
- -.70 or lower indicates a very strong negative relationship

##### Related Links

- Aggregate Function
- For supported data sources when using the CORR() aggregate function.