6 Replies Latest reply on May 9, 2016 7:26 AM by Łukasz Majewski

# Calculated field linked to FIlter selection??

Hello Everyone,

Please can someone try and help me regarding calculations and filters?

I am currently trying to show a specific manufacturer (out of a list of many) versus the total sales of the category in a specific region.

I have used this calculation " If [Manufacturer]= "Mine" then [Value] else 0 end " and this does pull the manufacturer I would like and I can compare this to a filtered selection of all other manufacturers - but i would like the calculation to be dynamic.

For example - if i chose a competitor manufacturer then i want to see total category sales compared to that specific competitor. With the above calculation however, when i chose a different manufacturer the chart goes blank.

An additional problem with this view in tableau is that share calculations show the share in each region as cumulative to total market as opposed to showing what share my manufacturer has in that specific region.

Below is an image to try and help explain.  Each purple bubble is my manufacturer, the orange bubble is the category.  I would like the purple bubble to change based on the manufacturer i select in the filter and the orange stays as total category.  Each set of purple and orange bubbles represents a region.  The share shown in the image however sums to 100% instead of representing the share the manufacturer holds in that region.  Fro example, the bottom left purple bubble is almost as large as the orange bubble but the share displayed is 48% when the share within that region is closer to 80%.

I have also attached a raw data excel file.  Its the data behind the below image.

Please can someone try to help me?

Thank you.

• ###### 1. Re: Calculated field linked to FIlter selection??

I have to do this all the time. Here's how I do it...

Create a parameter for your customer name.

Then create a calculated field called cust v market or something like that.

The field should say, if customer = [customer parameter] then customer else "Market".

I've attached superstore sample for you.

• ###### 2. Re: Calculated field linked to FIlter selection??

In your case, you would drag cust v market to color and size shelves.

• ###### 3. Re: Calculated field linked to FIlter selection??

Hi Cathy,

Thanks very much for the help on this.

Your solution would work but would lead me to a similar stage I am currently at - the parameter is then locked to a specific manufacturer in the list.  If i then filter to a different manufacturer the chart goes blank.

I was trying to figure out if a parameter/calculated field can be dynamic in the sense that the "if customer = [manufacturer selected in filter]" and when i change my selected manufacturer then the calculation changes.

Doesn't seem to be possible though.

Thank you very much for your help though!

Kind Regards,

James.

• ###### 4. Re: Calculated field linked to FIlter selection??

Attached are two solutions: one based on table calculations and one using LoD.

You may build a dashboard where measure names would be covered with Customer/Other labels.

Cheers,

Łukasz

• ###### 5. Re: Calculated field linked to FIlter selection??

Lukasz, would you mind saving your workbook in 9.1 version too ?

• ###### 6. Re: Calculated field linked to FIlter selection??

you can do it yourself: Re: Items Active between Start and End Date

twbx is a compressed files; unpack and modify the twb as per the linked msg