问题
I have a problem with Filters.
I have a dimension with the values (0, 1, 2, 3, 4, 5). I want to use this dimension as a filter, but not to let the user the option to filter out the value "0". I don't want to exclude the values 0, the opposite - I want these values to ALWAYS be in the view, and let the user the chance to filter only between (1, 2, 3, 4, 5).
Is that an option? To remove a value from the filter but not from the data?
Any help would be very appreciated Thank you!!
回答1:
If I understood your question correctly then my answer is - Yes, there is a way to do so.
Let's say your dimension name is 'dim_field' having value (0, 1, 2, 3, 4, 5) then
- Create a parameter - let's name it as 'parm_field'. In create parameter window select 'data type' as string, 'Allowable values' as list, 'set from field' as dim_field (i.e. you dimension) and add one more row in this list as 'All'. Drag this row to top and select 'current value' as 'All'. Most importantly delete row having '0', as you don't want this to be in your filter and click ok.
- Click on this parameter and select 'Show Parameter Control'
- Create a calculated field 'is_DimField_selected' and define it as:
IF [parm_field] == 'All' THEN 'Y'
ELSE
IF [parm_field]=[dim_field] THEN 'Y'
ELSE 'N'
END
END
- Add this calculated field to filter and select 'Y'. Voila!
Kindly don't forget to mark as answer if it solves your problem ;)
来源:https://stackoverflow.com/questions/44827291/hide-value-in-filter-tableau