1 Reply Latest reply on Aug 9, 2018 11:11 PM by Yuriy Fal

    Error in Famous Distribution Curve Formula

    Matthew Ingle

      Hi! Can anyone solve the error in this famous example of how to add a normal distribution curve to a histogram? The page linked to is here Fitting a Normal Curve to a Histogram | Tableau Public

      The error is in the formula

      (1 / ([St Dev] * SQRT(2*PI()))) * EXP(-((ATTR([Profit Bin]) – [Mean])^2 / (2*[St Dev]^2))) * [Profit Bin Size] * TOTAL (SUM([Number of Records]))


      [Profit Bin] is never defined and neither is [Profit Bin Size]. The author writes,

      "Rather than using Tableau’s automatic binning feature, create your own calculated field bins by writing a formula to round the profit amount down to the nearest one thousand

      INT ( [Profit] / 1000 ) * 1000

      We can also introduce a Parameter here to allow a user to easily change the bin size. If you wish, create a Parameter called “Profit Bin Size” and then change the formula to…

      INT ( [Profit] / [Profit Bin Size] ) * [Profit Bin Size]"


      Later the author references [Profit Bin], which I can only assume is the formula INT ( [Profit] / [Profit Bin Size] ) * [Profit Bin Size]. However, what is the [Profit Bin Size]? There already exists a parameter in the superstore data set called [Profit Bin Size]. Are we to overwrite this? Does anyone actually know how the author defines the calculated field [Profit Bin] and [Profit Bin Size] since the author did not define them in the post?