3 Replies Latest reply on Jul 17, 2018 2:16 PM by Alan Huddart

    Calculating Skewness and Kurtosis for a distribution in Tableau as formula?

    bhairav.mehta

      I understand that summary report on Tableau creates Skewness and Kurtosis.

       

      Is there a way to calculate Skewness and Kurtosis as calculated column using a formula?

      Thanks

      Bhairav Mehta

        • 1. Re: Calculating Skewness and Kurtosis for a distribution in Tableau as formula?
          patrick.byrne.0

          Hello Bhairav,

           

          I believe this might be possible using the functions available in Tableau Desktop, thought I am not a statistical expert or a calculations expert. But, I did find the following information on the functions in Tableau Desktop

           

          + Functions

           

          If you run into a particular issue trying to build the calculation, I would suggest posting what has been attempted as a packaged workbook, there is a better chance the community will be able to assist!

           

          Happy analyzing and I hope this helps!

           

          Cheers,

          Byrne, Patrick

          • 2. Re: Calculating Skewness and Kurtosis for a distribution in Tableau as formula?
            Alan Huddart

            Hi Bhairav,

             

            I managed to create my own version of Kurtosis just using calculated fields. This will replicate the KURT() function as used in Microsoft Excel.

             

            Firstly, there is a FIXED calculation to get the COUNT of all records (not sure if it is possible to replace this calculation and put it into the following Kurtosis calculated field directly):

            {FIXED:COUNT([Metric])}

             

            Then this calculation should provide you with the Kurtosis figure:

            (

              ((SUM([Count])*(SUM([Count])+1))

            /

            ((SUM([Count])-1)*(SUM([Count])-2)*(SUM([Count])-3)))

              *

              SUM((([Metric] - {FIXED:AVG([Metric])})/{FIXED:STDEV([Metric])})^4)

            )

              -

              ((

            (3*((SUM([Count])-1)^2)))

            /

            ((SUM([Count])-2)*(SUM([Count])-3)

            ))

             

            I've attached a workbook with an example of this (as well as the source file) and have added extra metrics to break down the different steps that go along with this. Calculation is based off the Excel Help page which explains the KURT() function.

             

            Hope this helps!

             

            Alan

            2 of 2 people found this helpful
            • 3. Re: Calculating Skewness and Kurtosis for a distribution in Tableau as formula?
              Alan Huddart

              Similarly, Skewness can be calculated with the following calculation (assuming you already have the Count metric which I show above):

               

              (SUM([Count])
              /
              ((SUM([Count])-1) * (SUM([Count])-2)))
              *
              SUM((([Metric] - {FIXED:AVG([Metric])})/{FIXED:STDEV([Metric])})^3)

               

              Again, this is based on the SKEW() function in Excel.

              3 of 3 people found this helpful