2 Replies Latest reply on Mar 4, 2018 3:20 AM by Khaldoun Al-Turk

    Using Parameter to get (Top 20)

    Khaldoun Al-Turk

      Hi all,

      I have a Diagnosis code list, and I want to count how many patients I have for each code.

      The code list is in dimension. At the same time, I want to create a dynamic parameter so I can view top 10, top 20 for each code.

       

      I tried to (filter) my code list using (Top tab) -> then select (by field) function but unfortunately couldn't succeed.

      Also, I tried to link this to a parameter so I can control the size but unfortunately I am getting wrong results.

       

      Please advice.

      Thanks

        • 1. Re: Using Parameter to get (Top 20)
          YASIN CAN PARLAK

          Hi Khaldoun,

           

          Here is the basic steps to filter top N with parameter! If you have any question, please ask.

           

          1. Drag "Manufacturer "to the Rows shelf. (Manufacturer is a sample dimension name)
          2. Drag "Sales" to the Columns shelf.
          3. In the Data pane, click the drop down to the right of Dimensions and select Create Parameter.
          4. Name the Parameter (in this case "Top N").
          5. To the right of Allowable values:, in the Create Parameter window, select Range.
          6. Under Range of values, specify the Minimum, Maximum, and Step size desired.
          7. Click OK.
          8. Right click on "Manufacturer" in the Rows shelf and select Edit Filter.
          9. Navigate to the Top tab in the Filter window.
          10. Select By field:
            1. In the second drop down field to the left of "by", select "Top N"
            2. Ensure that the field to filter by (usually a measure) is specified, in case "Sales" as "Sum".
            3. Click OK.
          11. In the Data pane, under Parameters, right click on "Top N" and select Show Parameter Control.
          12. In the upper right corner of the view, there is now a "Top N" slider and number field. Changing this field by moving the slider, will change what is shown in the view.
          13. Lastly, in the toolbar at the top of the screen, click on the Descending button icon, which will sort SUM(Sales).

           

          Please don't forget to mark correct Thank you.

           

          Sincerely,

          Yasin.

          1 of 1 people found this helpful
          • 2. Re: Using Parameter to get (Top 20)
            Khaldoun Al-Turk

            Thank You very much Yasin for your prompt reply. You helped me in creating the parameter correctly.

             

            But if I may ask you since I am somehow new to Tableau and I feel I was not clear in my first question, let's say I have 10 departments, and within those departments, I need to see Top N for each "Manufacturer " in each department using the parameter.

             

            So first what I think, I should filter the desired department/s, then I need to use the parameter to see the top N for that "Manufacturer ", and this is the step which I am struggling in.

            Because when I select a specific department, and then I use the parameter to see the Top 10 for example within this department, the result will show just the top 4 despite that department has more than 70 "Manufacturers". On the other hand, if I am not doing any filtration, the parameter is working correctly.

             

            Thanking you in advance & best regards.

            Khaldoun