Alan Ng
Alan Ng

Reputation: 1

How can I use Tableau parameter to show different value in worksheet

I created a dashboard for manpower allocation. Purpose of this is to project Monday to sunday workload and assign workers. I created a parameter but I noticed that if I have 7 worksheet to show different day, I need 7 parameter. Is there any way I can create just 1 parameters(list) and select different parameter value individually from each worksheet.

I tried creating 7 parameter for each day. So apply each parameter to each worksheet.

Upvotes: 0

Views: 289

Answers (1)

MUFF.
MUFF.

Reputation: 791

You could create a calculated field to interact with all the worksheets as a filter and have it driven by a single selection of let's say a day_of_week parameter.

Create the Parameter:

When you create your day_of_week parameter, set it up as an integer and a list so it looks similar to the grid below:

Value Display As
1 Monday
2 Tuesday
3 Wednesday
... ...
8 All Days

Create the Logic:

Let's create a calculated field day_of_week_logic to hold all the use cases for our parameter.

CASE [day_of_week]
WHEN 1 THEN IF DAY([your_date_field]) = "Monday" THEN [your_date_field] END
WHEN 2 THEN IF DAY([your_date_field]) = "Tuesday" THEN [your_date_field] END
...
WHEN 8 THEN [your_date_field]
END

Note: I did this in my head; there may be errors when comparing different types ie. comparing strings and integers/ dates and or aggregated values to non-aggregated values

Lets break down the calculation above. First grab our parameter then based on our selection of it (say we choose "Monday") it will return a value (in this case, "1"). We then write what we expect Tableau to return when that value is present. We want to return all Mondays so we use the DAY() function to find our Mondays and return all the dates that meet this criteria.

Although it was not specified in your question above, if you only want a single week, this solution will still work if you filter ALL the data touching these sheets for a specific, albeit valid, date range.

Apply to Worksheets:

  1. Drag our day_of_week_logic to the filter pane and set to "True".
  2. Right click and choose Apply to Worksheets, select all applicable worksheets.
  3. Show day_of_week parameter on dashboard.

Upvotes: 0

Related Questions