2 Replies Latest reply on Aug 17, 2017 10:50 AM by Arthur Howland

    Creating a dynamic Top N pie chart with "Other" using # of Records [10.2]

    Arthur Howland

      Hello all,

       

      Not having much success using similar questions regarding top N pie charts with an "other" category to consolidate the bottom findings.  The examples all use sum of sales and I can't seem to repeat the procedure when it comes to [number of records].  The core issue is that when I use a filter, the set I have is not dynamically linked to the new filter so my pie chart is wrong.  When it comes to dynamic top N ranking of [number of records] (with 'other'), how should I set up the following:

       

      What should my parameters be?

      What should my Set be?

      What should my Calculated Field be?

       

      If I could make a developer request, I know it probably doesn't work this way but in the Sets > Edit Set > General Preferences, there should be a button for "Use all Data after filters are applied."

        • 1. Re: Creating a dynamic Top N pie chart with "Other" using # of Records [10.2]
          Patrick A Van Der Hyde

          Arthur,

           

          Did you review this post - Top N and Others Pie Chart   - the key is for those filters to be added to the context to get them to apply per that post. 

           

          Patrick

          • 2. Re: Creating a dynamic Top N pie chart with "Other" using # of Records [10.2]
            Arthur Howland

            Patrick,

             

            Your link was very helpful and think I've got it figured out.  I'm going to format the answer I'm looking for so I can search for it later - I do top N's a lot.

             

            Goal:  Tableau top 10 -- Dimension = [Error Message], Measure = [Number of Records] + 'Others' catch-all result

             

            Procedure:

                 1)  Create Parameter: [Top N] = integer, current: 10, range: 1-10.

                 2)  Create Set by: right-click Dimension "Error Message" > Create Set > "Top N Error Messages Set" > Top > By Field, Top: [Top N] by Number of Records, Sum.

                 3)  Create Dimension: [Chart DIM] = IF [Top N Error Messages Set] THEN [Error Message] ELSE 'Others' END.

                 4)  Create Measure: [Chart DIM Measure] = IF [Top N Error Messages Set] THEN [Number of Records] ELSE 0 END.

                 5)  Setup

                      a)  [Chart DIM] goes into ROWS.

                      b)  [Chart DIM Measure] goes into ROWS.

                      c)  Any filters > right-click > "Add to context"

             

            Optional:

                 6)  Pie Chart

                      a)  [Chart DIM] goes into colors

                      b)  [Sum(Number of Records)] goes into size

                      c)  [Sum(Number of Records)] goes into angle

                

            What I learned:  The new dimension "[Chart DIM]" and measure "[Chart DIM Measure]" are sensitive to the "add to context" filters.