Jay
Jay

Reputation: 465

Tableau - Toggle between 2 measures by single select filter on one basic text grid

looking to have a basic text grid by month by product, and then have a single filter on only 2 of the measures. For example:

Measures Filter
------------------
[ ] Sales      <-- only show this
[X] Quantity   <-- and this as options
[ ] Interest       (don't show in filter)
[ ] Fee            ( don't show in filter)



          JAN   |   FEB  |   MAR  |  APR  |  MAY  | etc ...
products 
ITEM1      x         x        x       x       x
ITEM2      x         x        x       x       x
ITEM3      x         x        x       x       x

So the user can basically toggle between Sales or Quantity, and whichever they click on will fill out the x by month.

I was able to get this to work for everything except only showing the 2 measures I want to filter for. It only shows all measures for me in the filter and I can't figure out how to hide them.

What I did was Drag Date to columns Drag Product and MeasureNames to Rows

Can someone please help me on getting this correct? Any help or guidance is appreciated!

Upvotes: 0

Views: 812

Answers (2)

Andy TAR Sols
Andy TAR Sols

Reputation: 1735

There is another options to add to Anil's good suggestion. You can also use Measure Names as a filter. Hide all measures apart from those you want in the filter, then put Measure Names on the filter shelf.

However, this means you can't use the hidden measures from the data source elsewhere, which can be a deal breaker. Duplicating the data source is a way around that limitation.

But if you only want to show the 2 measures and are happy with single select, then choosing the measure by parameter is the better option, as Anil suggests.

Upvotes: 1

AnilGoyal
AnilGoyal

Reputation: 26218

This is not the correct use case of FILTERS. Filters are normally used to filter (read subset) the data (read rows). Say for example If your dataset has 1000 rows/records and you want some report/visual/aggregation on say 500 rows (based on some criteria of course) you have to filter the data. For selection of argument (user based) in some report/viz, etc. Parameters are used.

Your desired example output is also a perfect case of use of Parameters. You may proceed as follows-

Step-1 Create a parameter (say parameter 1) with values as SALES and QUANTITY.

Step-2 Create a calculated field (say CF1) with the following calculation

CASE [parameter 1]
WHEN 'SALES` THEN [sales]
WHEN 'Quantity' then [Quantity]
END

Note: It is assumed that your field/column names in dataset are sales and Quantity

Step-3 Build your view (Crosstab here) with

  • months on Columns shelf
  • products on rows shelf
  • CF1 on text in Marks card (alternatively just double click it)
  • Choose measure for aggregation of CF1 as desired (default will be sum)

Step-4 right click paramter 1 and click show parameter. (select desired measure for aggregation in crosstab)

VOILA your desired view is complete. Good luck.

Upvotes: 2

Related Questions