2 Replies Latest reply on Aug 8, 2016 5:23 PM by nigel.matthew

    Top N filter with Pie Chart on Map issues

    nigel.matthew

      Hi,

       

      I am trying to apply a Top N filter to a map that uses pie charts for the marks.  Essentially I have a number of geo-coded "stations" that are read over time.  Each time they are read the station can be either "Active" or "Passive". 

       

      I would like to show the top n sites on a map by the number of readings that have been taken at each. 

       

      I would like each mark on the map to be represented by a pie chart that shows the ratio between passive and active reads.

       

      When the map marks are circles the top N filter works as expected (top N set to 5, 5 locations shown):

       

       

      But when coloured by status as a pie chart I don't seem to be able to get the correct number of sites shown.  I have tried a couple of table calculations in the filter but cannot get it to work:

       

      1. Table calculation partitioning Status, addressing Lat and Long.  Top N set to 5 - for each "Status" top 5 is shown (i.e. 5 orange segments/spots, 5 blue segments/spots - leading to a total of 6 locations, not 5 as intended):

       

       

      2. Table calculation partitioning Nil, addressing Status, Lat and Long.  Top N set to 5 - top 5 of "Status" is shown regardless (i.e. 5 segments/spots in total (regardless of colour) but not 5 unique locations):

       

       

      It seems pretty simple but I don't seem to be able to get this to work.

       

      Packaged workbook attached - any help greatly appreciated (using Tableau 9.3).

       

      Many thanks

        • 1. Re: Top N filter with Pie Chart on Map issues
          Michel Caissie

          Nigel,

           

          if you compare sheet 4 and sheet 5 , you can see that your Top Reading locations get mixed up when you add the Status dimension in the view because the rank is not based on the total number of records per station  but on every  station-status group.

           

          Here is what you can do;

          -compute the station count using the formula

          WINDOW_SUM(SUM([Number of Records]))

           

          - change Top Reading Locations  for

          RANK_UNIQUE([windowCount(station)])<=[Top Readings by Station]

           

          -on the view  Partitionning status  add Station Number on the Detail shelf

           

          -and finally the tricky part Edit the table calculations

            -right-click Top Reading Locations - Edit Table Calculation

                Calculated Field  : Top Reading Locations

                select Advanced and put  Station Number, Lat, Long in the Addressing

                Deepest, None

            Calculated Field  : WindowCount(station)

                select Advanced and put  Station Number, Status, Lat, Long in the Addressing

                Deepest, restarting on Station Number

           

           

          Its important that you don't embed the station count formula directly in the Top Reading Locations otherwise you wont be able to apply different computing on the windowSum and the Rank

           

          Michel

          2 of 2 people found this helpful
          • 2. Re: Top N filter with Pie Chart on Map issues
            nigel.matthew

            That's great Michel - thanks very much for that - most appreciated.

            1 of 1 people found this helpful