Change the color of items in quick filter based on certain conditions

Published: 14 Apr 2023
Last Modified Date: 17 Apr 2023


How to change the color of items in a quick filter to disable a selection when there is no record for a certain filter value?
User-added image


  • Tableau Desktop


Follow along with the packaged example workbook.  The example workbook and video (without sound ) is available in the "Attachments" section to the right of this article text.

1. Create the following calculated field Year_list
if isnull([Sales]) then null
else DATEPART('year', [Date]) END
2. Create the following parameter Parameter year.
User-added image

3. Create the following calculated field filter
DATEPART('year', [Date])=[Parameter year]
4. Add filter to the filter card, select True
5. Create a new worksheet Sheet 2 as to show the filter list of YEAR(Date)
6. Add YEAR(Date) to Rows, and Text in the marks card
7. Right click YEAR(Date) in the rows, uncheck Show Header
8. Create the following calculated fields

7. Add data field Color to Color and 1 to Detail in the Marks card
8. Edit the color legend to: True > gray, False > black.
9. Create a new worksheet Year (Date) as to show the selected value of YEAR(Date).
10. Add Parameter year to Text, change the number format to: Custom 0;-0.
11. Add 1 to Detail in Marks card.
12. Create a Dashboard, add Sheet 1 to the dashboard.
13. Add a Horizontal object to the dashboard.
14. Add Sheet 2 and Year (Date) to the above Horizotal object.
15. Click the More Options button of Sheet 2 and uncheck Title.
16. Add the following parameter action to the dashboard
User-added image
17. Add the following filter action to the dashboard
User-added image
Did this article resolve the issue?