Dear Tableau Community,

In my analysis I need to calculate the coefficients from the regression of Y over X (Y=alpha + beta*X) , and need to use these coefficients in a further calculations to make predictions on new data.

This means that I will have to multiply the calculated coefficients with a new variable X_new (Y_new=alpha + beta*X_new).

I successfully calculated the coefficients as

beta= WINDOW_SUM(AVG([X])-WINDOW_AVG(AVG([X])))^2 / WINDOW_SUM((AVG([Y])-WINDOW_AVG(AVG([Y]))*(AVG([X])-WINDOW_AVG(AVG([X]))) =

alpha= Y-X*beta

This formula calculates correctly the Slope and the Intercept but it does so in an Aggregate way, so that if I now want to calculate Slope*X_new the calculations gives me the error

"cannot combine aggregate and non-aggregate measures in the same calculations".

As aggregating X doesn't make sense for my analysis I was wondering if there's a way to disaggregate Slope and Intercept, or if there is another way to calculate them directly as a non-aggregate field. I have been trying several methods and haven't succeeded so far.

Any help would be much appreciated!

Thank you,

Alice

This content has been marked as final.
Show 0 replies