3 Replies Latest reply on Apr 8, 2013 9:56 PM by Jim Wahl

    Adding "N" for box plot

    Ritu Kapur

      Hi --


      I am having a bit of trouble figuring out how to do the following:

      • I have multiple rows per patient, with various dimensions and an outcome measure
      • It was easy enough to make a nice box and whisker plot (quartiles) for my outcome measure BUT
      • Because PATIENT_ID is on the Path and Level of Detail, when I ask Tableau to count how many patients are in a given category by using COUNTD(PATIENT_ID) all I get is a bunch of 1's. It won't let me aggregate.


      I am getting frustrated because it's not that helpful seeing the box and whisker if you don't know what the N is. Our data are super-overdispersed so the size of the range isn't really the best indicator. I could go back and rewrite the SQL, pull quartiles in a hardcoded way, and then just plot a bunch of different reference lines, but for all of the combinations I am trying to look at, that would be less than ideal. Any ideas would be much appreciated!!


      PS - Sorry I can't share the actual dataset since it's confidential patient data, but am happy to go into more detail re: columns, etc. if necessary!




        • 1. Re: Adding "N" for box plot
          Jim Wahl

          Hi Ritu,


          Try creating a calculated field, N, with the formula: SIZE()


          Add N to your view (tooltip?) and on the pill, select Compute using > PATIENT_ID


          Another option is to use an alternative format box plot without the Path trick. Remove PATIENT_ID from path and change the Mark type to shape > circle. You might want to change the color to make the marks semi-transparent.


          Now you can see the individual points, which I think is helpful, especially for outlier detection. With the Path technique, you can't see if it's only one outlier pushing the bars to the max / min, or if there is a group, or if there is a long tail.



          • 2. Re: Adding "N" for box plot
            Ritu Kapur

            Hi Jim,


            Thanks for the reply! I think we are getting closer!


            I tried both of the above suggestions. It's great to know about SIZE(), however in this case, since we have more than one row per patient, size() gives me the number of records instead of the number of patients.


            I also had arrived at creating the box plot without using the Path trick - you're right, it's so much more informative to be able to see individual data points. However, it still seems to think that I am partitioning by PATIENT_ID, even though I have removed it from the level of detail and the path.


            I will keep trying things (perhaps experimenting with using size()) but if you have any more ideas, I would love to hear them!




            • 3. Re: Adding "N" for box plot
              Jim Wahl

              Hi Ritu,


              If you could post an example twbx (packaged tableau workbook), even with 10 or 20 dummy records in Excel, it'll help. I'm sure whatever you need is possible in Tableau, but it'll probably require a table calculation, and table calcs are often specific to your view layout and data.