

Now you have the four components they need to be put together: (Part 1 – Part 2) / (Part 3 – Part 4) which looks like: Part 4: the final part is (the window_sum of x) 2 Part 3: this is SIZE multiplied by the window_sum of x 2 Part 2: this is the window_sum of x * the window_sum of y Part 1: this is simply SIZE multiplied by the window_sum of x*y For this example, x = Sales and y = Profit. Once you break up this formula into 4 parts, it’s relatively easy to translate into Tableau. Where n = SIZE, x and y are the variables, and = window_sum. In order to calculate the slope of the regression line you need to use this formula…but translated into Tableau: Therefore, to calculate linear regression in Tableau you first need to calculate the slope and y-intercept.

Where M= the slope of the line, b= the y-intercept and x and y are the variables. In order to calculate a straight line, you need a linear equation i.e.: The regression line is calculated by finding the minimised sum of squared errors of prediction. The line of best fit comprises analysing the correlation, and direction of the data estimating the model and evaluating the validity of the model. It is used to identify causal relationships, forecasting trends and forecasting an effect. For example, on a scatterplot, linear regression finds the best fitting straight line through the data points. Linear regression is a way of demonstrating a relationship between a dependent variable (y) and one or more explanatory variables (x).
