KNOWLEDGE BASE

 Including Filters in Calculations Without Including them on the Filter Card


Published: 30 Nov 2015
Last Modified Date: 07 Sep 2018

Question

How to include filters in calculations without including them on the filter card. 

Environment

Tableau Desktop

Answer

Option 1

Create a logic calculation by using an IF / THEN statement to return a measure for only certain dimension values. See an example of a calculated field below: 
If [Color] = "Yellow"
Then [Size]

End

The example returns the field [Size] for rows of data with the color value of Yellow. [Size] could be replaced by a different field in the formula to return something different. The value "Yellow" could be replaced with a parameter to allow the end user to change the value that [Size] is being filtered to.
 

Option 2

You can filter the calculation without filtering the entire view, you may use this type of calculation using the "Include" LOD:

{INCLUDE [Added Dimension]: Sum(IF [Added Dimension] = 'FilterValue' THEN [Non-Aggregated Measure] END)}

Did this article resolve the issue?