Reusable Simple Linear Regression

Version 1



    There has been a lot of discussion on the forums about getting basic statistical tests into Tableau.  With the assistance of a couple of other members, I was able to create a completely reusable Simple Linear Regression procedure.  An astute user might say "Trend Lines already do that!"  That user would be correct.  Alas, I don't think there is any way to get the value of the trend line back out in order to do calculations with it.




    Data set stored in Excel.

    Does not have to be at the appropriate grain.

    The workbook will handle any and all necessary aggregations.




    Open the attached .twbx

    Right-Click the Excel Data Source

    Edit Connection (Change to your Excel Worksheet)

    Edit the following calculated fields:

         X Value (Linear Regression): The measure you would like to see on the X (horizontal) axis.

         Y Value (Linear Regression): The measure you would like to see on the Y (vertical) axis.

         Grain: The dimension of the grain you would like your measures aggregated to.

    Apply any filters you would like.  Please note that these filters cannot be based on table calculations.  It is possible to use table calculations filters, albeit with more effort.


    That's it.  Your Simple Linear Regression is complete.


    There is an in-depth blog post describing this technique at


    Breaking BI: Performing Simple Linear Regression in Tableau


    Example Calculation:


    Related Calculations:

    Reusable Z-Test for 1 or 2 Independent Means:



    Revision History: