2 Replies Latest reply on Nov 3, 2019 6:20 AM by Soumitra Godbole

    How do I create a calculated field that calculates slope and intercept of trend line?

    Daniel Lee



      I am using Tableau version number 2018.3.5 Desktop Professional edition. I attached demo_20191101_14_39.twbx to this post.


      In demo_20191101_14_39.twbx worksheet named "Sheet 1", I have a grouped bar graph and trend lines. See screenshot below:




      I want to know how to calculate the slope and intercept for one of the trend lines. Please see screen shot below:



      I have highlighted in yellow in the screenshot above the values for slope and intercept. Slope = -0.0002369 and intercept = 9.04548.


      Can someone show me how to create a calculated field to generate the slope and the intercept? I read this and am still having a hard time figuring this out.


      It would help a lot if you can include a step-by-step instruction as well as add a Tableau workbook to this post. If attaching a Tableau workbook, please make sure to use Tableau version number 2018.3.5 or older. Ther reason for this is because I do not have a newer version of Tableau. So, I cannot open the workbook from Tableau versions newer than 2018.3.5.


      Any help would be greatly appreciated!