Giuliano
Giuliano

Reputation: 73

Tableau: Create a parameter to see individual fields or sum

I have 3 variables of interest:

My dashboard is set such as each row represents a city, an in the column there is the amount. The amount column is divided in 2: Round A and Round B. (the user can see the amount for each round next to each other).

I am trying to create a filter or parameter that let's me see the Amount for round A and B next to each other or the sum of both. Currently, the filter allows me to see round A or round B or both next to each other. I want to also be able to see the sum.

I was advised to make a parameter this way (it does change anything):

  1. Right click on Round measure and create parameter. I added values from Round.
  2. Show Parameter
  3. Right Click on Round measure and create set. On the condition tab, by formula: [Round] = [Round Parameter]

Thanks (absolute beginner on Tableau)

enter image description here

Upvotes: 1

Views: 247

Answers (1)

AnilGoyal
AnilGoyal

Reputation: 26218

I think you want something like this (see the GIF)

enter image description here

Proceed like this-

sample data taken

enter image description here

Step-1 create a parameter (say parameter 1) like this

enter image description here

Step-2 create two calculation fields with the following calculations-

ROUNDS with the following calculation

CASE [Parameter 1]
when 3 THEN [Round]
when 1 THEN (IF  [Round] = 'A' THEN [Round] end)
when 2 THEN (IF  [Round] = 'B' THEN [Round] end)
when 4 THEN 'Total'
END

Step-3 another calc field say AMTS as

CASE [Parameter 1]
when 3 THEN [Amt]
when 1 THEN (IF  [Round] = 'A' THEN [Amt] end)
when 2 THEN (IF  [Round] = 'B' THEN [Amt] end)
when 4 THEN [Amt]
END

STEP-4 Build the view using ROUNDS instead of round and AMTS instead of Amt, show parameter, click on NULL field when shown and EXCLUDE it. and you are done.

enter image description here

Upvotes: 1

Related Questions