KNOWLEDGE BASE

Weighted Average Controlled by Parameters


Published: 17 Oct 2016
Last Modified Date: 09 Aug 2017

Question

How to create a weighted average that uses parameters to control the weights of the measures within Tableau Desktop, and reflects the expected range of numbers in the weighted average result?

Environment

Tableau Desktop

Answer

Create a set of parameters and calculated fields to use for the weighted average:
  1. Right-click the data pane and select Create parameter
    • Name the parameter accordingly (ex: "Variable 1 Weight")
    • Make sure the data type is "Integer"
    • Under allowable values select "List"
    • Create a list of values that represent the weight for the parameter (ex: 1-5) and label accordingly.
  2. Repeat step 1 as necessary for each measure you are creating the weighted average from.
  3. Show the parameter controls for all of the parameters.
  4. Select Analysis > Create Calculated Field. 
  5. Create a calculated field with a formula like the following:
    ([Variable 1 Weight]*[Variable 1])+([Variable 2 Weight]*[Variable 2])/([Variable 1 Weight]+[Variable 2]
Did this article resolve the issue?