1 Reply Latest reply on Dec 12, 2018 3:56 PM by Patrick Van Der Hyde

    Need to calculate Regression Coefficients in a Non-Aggregate way

    alice scarduelli

      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            



      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,