1 Reply Latest reply on Aug 24, 2018 2:33 PM by Aaron Dobbins

    Ranking with Lines Graphs and Dates

    Patrick Maynard

      I am trying to make a line graph that shows the top performing (in total) "X" (Top 6 currently in my screenshot) zip codes that is input into the "N" Parameter Box. The calculated field and filter (True/False based on the calculated field) show the data points for the top 6 each month. I was hoping for this calculated field to produce 6 different lines for the zip codes with the highest total.


      Does anybody know how to achieve this goal or know if I am on the right path?


      I am in Tableau Version 2018.1

        • 1. Re: Ranking with Lines Graphs and Dates
          Aaron Dobbins

          Hi Patrick,


          Add the Loc filter to context by right clicking and choosing "Add to Context".  This makes sure that filter is applied first, which helps when you want to do Top N filtering.


          Then add Time as a filter and go to the Top tab in the filter.  Select the By Field radio button, then Top in the first drop down.  In the second drop down, select your parameter created for the "N" Parameter.  Next drop down select Time and finally, select Count.  It should read:


          By field: Top "N" Parameter by City Count.


          Example using Superstore below...


          If you are also prompting on Top/Bottom you would build a second sheet that was identical, except you would use Bottom in the first drop down shown in the above screenshot instead of Top.  Then drop both sheets on your dashboard in a container and use the hide/show technique to show the right sheet based on top/bottom selection.


          You create a calculated field for "Top/Bottom" and set it to [Parameters].[Top/Bottom Parameter Name].  Then drag that field into the filter on your Top sheet and select the "Top" value.  Drag that field onto the filter of your Bottom sheet and select the "Bottom" value.  As long as you have not fixed the height or width on either sheet, they will shrink to invisible when the opposite parameter value is selected.  Both sheets must be in the same container for this to work.  Typically I will use a vertical container and drop the sheets into that container on the dashboard but you can use horizontal if that is easier.  You must also hide the Title on both sheets or they will not hide properly.  You can create a third sheet and drop your parameter on it to create the title if needed.  See attached example.