4 Replies Latest reply on Nov 23, 2016 9:06 AM by Joe Oppelt

# How to apply filters to only ONE part of a calculated field?

Hi all

I have a set of data that I'm applying 2 filters to (life stage and model of car driven).

I also have the following calculated field:

On one of my worksheets, I am filtering the data (that is created using this calculated field) by the above 2 filters. However, it seems the filter is applying to both of the elements within the calculated field, but I only want it to apply to one of the elements.

Does anyone know how I can apply the 2 filters ONLY to [% of Sales Count] but NOT to [% of Population] within this calculated field?

Thanks

Jag

• ###### 1. Re: How to apply filters to only ONE part of a calculated field?

One way would be to calculate the % of Population using FIXED calculations.

FIXED calculations are calculated before normal filters are applied so won't change when the 2 filters are applied. Here is the tableau order of operations if you're interested: Tableau's Order of Operations

Note this could have impacts elsewhere, for example if your % of Population field should be affected by some filters, but not the 2 mentioned, those other filters would have to be put to context, as per the order of operations.

• ###### 2. Re: How to apply filters to only ONE part of a calculated field?

Hi Andrew,

Thanks for the response - but the calculation doesn't seem to be working for me. I keep getting the message 'level of detail expressions cannot contain table calculations'

[% of Population] is the table calculation. Is there any way to apply a FIXED calculation to a table calculation?

Thanks

Jag

• ###### 3. Re: How to apply filters to only ONE part of a calculated field?

You would need to fix the base level calculations BEFORE calculating the %.

For example if your % field was 50%, you can't fix the 50% but could do {FIXED: 50} / {FIXED: 100}

Hope that makes sense

• ###### 4. Re: How to apply filters to only ONE part of a calculated field?

This is an example of why it's best to upload a sample workbook showing your issue.

New information is coming out as suggestions are being offered.  The presence of a table calc changes how something like this needs to be approached.

I recommend you upload a sample workbook so that all the factors and conditions that impact this question can be taken into account.