ナレッジベース

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


発行: 14 Apr 2023
最終修正日: 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
     Color
isnull(SUM([Sales]))
     1
1

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
この記事で問題は解決しましたか?