3 Replies Latest reply on Apr 12, 2012 11:28 AM by Tracy Rodgers

    Labels with % share for Top commodities

      Hi,

       

      I am trying show top 10 commodities, but label each top 10 good with the %share. Tableau when displays the %share, does so only for top 10 and not all commodities. So, for example, if out my entire budget, I have purchased 50 goods, I want to show only the top 10 most expensive ones. But, for each good, I want to show the label as %share of each good relative to my entire budget that is spent on all 50 goods, as opposed to showing the %share of only the top 10 goods, even though, I am showing just teh top 10 in my bar chart.

       

      Any help will be highly appreciated!

       

      Thanks very much,

      BD

        • 1. Re: Labels with % share for Top commodities
          Tracy Rodgers

          Hi BD,

           

          From your description, it sounds like you are finding the top 10 commodities by using the filter. Using the filter will exclude the rest of your data. However, by using the index() function, you may be able to get the desired results. Create a calculated field similar to the following:

           

          index()<=10

           

          Place this on the filter shelf and check True. Since this is a table calculation, you'll want to make sure that it is correctly being computed (right click on the calculation on the filter shelf and select Compute Using).

           

          Hope this helps!

           

          -Tracy

          • 2. Re: Labels with % share for Top commodities

            Hi Tracy,

             

            Thanks so much for your help! The trick worked. But, my problem still lingers as I have an additional layer of information that I display using the color shelf. For example, lets say that I use a category variable which groups goods in two classes - Luxury and Normal. I then use this category variable in the color shelf. When I do that, the trick you showed above loses its merit and I cannot display the way I want to. But, if I do not use the category variable in the color shelf then your trick works wonderfully well!

             

            Is there a way to use both the color and the top X with the correct percentages displayed as labels?

             

            Many thanks for your help.

            Regards,

            BD

            • 3. Re: Labels with % share for Top commodities
              Tracy Rodgers

              Hi Bhramar,

               

              Adding a different dimension to the color shelf makes for more complex view. Depending on the specific outcome, the following KB article may be able to shed some light:

               

              http://kb.tableausoftware.com/articles/knowledgebase/finding-top-n-within-category

               

              -Tracy