1 Reply Latest reply on Oct 12, 2012 10:25 AM by Alex Kerin

    Calculate % of overall datasource table

    Lindsey Hurley

      I'm trying to create a field in Tableau 7 that will show the % of the overall data source.  I need the ability to filter the data to specific categories and still show the % of the data source, not the % of the new total based on the filter.

      Example:  Category A is 74% of the overall data source.  When I filter out category C the percentage changes to 94%.  I need it to still show 74%.  Any help is greatly appreciated!

        • 1. Re: Calculate % of overall datasource table
          Alex Kerin

          If your percent calc is something like

           

          sum([value])/total(sum([value])

           

          you can use a trick to stop tableau from filtering for the total section.

           

          If your filter is [category], create a calculated field

           

          lookup(attr([category]),0)

           

          and use this as your filter. This is a table calculation that actually does nothing (it looks up the category field on the same row). Because it is a table calc, the filtering is done in tableau and not in the query. Because of this, total() is calculated across the whole dataset.