4 Replies Latest reply on Jan 8, 2016 2:53 PM by Andrew Watson

# Adding a calculated field to filtered columns

I have a worksheet where I use filters to eliminate unwanted variables. I am having difficulty in adding a calculation to determine what %  product 2 is of the total. (for some reason in this example my 'Total by Rows' isn't working.....) Thoughts? Thanks!

• ###### 1. Re: Adding a calculated field to filtered columns

David,

Try something like:

sum(Product 2)  /  ( { sum(Product 2) } + { sum(Product 1) } )

3 of 3 people found this helpful
• ###### 2. Re: Adding a calculated field to filtered columns

You would need to create a calculated field to sum the 2 measures - in this case Product1 + Product2.

Alternatively reshape your data to be a flat file, such as:

Area | Product | Amount

Home | Prod1 | 39

Home | Prod2 | 13

Shore | Prod1 | 72

...etc

• ###### 3. Re: Adding a calculated field to filtered columns

Hi Thomas, thanks so much for your help! Actually, the below is probably a better example of what  I'm trying to do. In an excel spreadsheet it's easy.......I just want to learn how to do it in Tableau.

The Columns "SwapType" show filtered results for MPEG4 & X1. I'd like to add a fourth column that calculates the % X1 of the total. Could you take a look? Thanks again:

• ###### 4. Re: Adding a calculated field to filtered columns

To show the fields as a % of total isn't complex using a table calculation and doing the Percent of Total:

Where things could get complicated is trying to replicate Excel. Tableau isn't Excel and some of the tabular things very straightforward in Excel are actually quite complex and convoluted in Tableau.

Let us know how you get on with the standard built in table calculation to begin.