1 Reply Latest reply on Aug 15, 2016 9:59 PM by Dmitry Chirkov

    Median from Two Columns

    Katherine L

      Hi All,

       

      Have a tricky Q today. I have one column that categorizes information (minutes of a train delay) and a column that counts the number categorized information (count of trains). I need to calculate the median using this aggregated data. How would I accomplish this in Tableau? A few forum searches turned up dry, so wanted to see if any of you Tableau ninjas had an idea

       

      Sample workbook and data are attached!

       

         

      TrainDelay (Mins)Train Count
      A Train304
      A Train602
      A Train901
      A Train1202
      B Train303
      B Train602
      B Train902
      B Train1204
      C Train302
      C Train601
      C Train905
      C Train1204
      D Train302
      D Train604
      D Train905
      D Train1201

       

       

      Average delay for Train A: 33.3 minutes

      Median delay for Train A: 60 mins

        • 1. Re: Median from Two Columns
          Dmitry Chirkov

          It is a tricky question indeed...

           

          I'm not aware of any math formula that would let you calculate this however my crazy idea is to use Tableau 10 and join your data with dataset that would duplicate your rows (1,2,2,3,3,3 ...) and then you could do a median.

           

          Of course, you'd have to do some more work to hide duplicate rows for all the other calculations - I added extra field in dataset to filter on that (see first sheet).

           

          Attached workbook is from Tableau 10 so you will have to download that order to use it.