VOOZH about

URL: https://www.geeksforgeeks.org/tableau/conditional-formatting-in-tableau/

โ‡ฑ Conditional Formatting in Tableau - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Conditional Formatting in Tableau

Last Updated : 4 Feb, 2026

Conditional Formatting in Tableau is used to highlight specific data values based on defined conditions. It helps users quickly identify top-performing, bottom-performing or exceptional values by applying different colours or visual cues. It is useful for:

  • Highlighting top and bottom categories
  • Emphasising important values in tables
  • Improving readability of tabular data
  • Drawing attention to insights instantly

Creating Conditional Formatting

Tableau does not have a one-click conditional formatting option like spreadsheets, but the same effect can be achieved using calculated fields, table calculations and colour encoding.

Note: For this article, a sample dataset "vgsales.csv" is used, to download click here.

Step 1: Create the Base Table

1. Drag and drop the Genre field to the Rows shelf.

๐Ÿ‘ Screenshot-2026-02-04-130048
Genre field to rows shelf

2. Drag and drop Global_Sales to the view so that it appears as the second column in the sheet (Text/Table view).

๐Ÿ‘ Screenshot-2026-02-04-130439
drop Global_sales next to Genre field to the view

Step 2: Create an Index Calculation

1. In the Data pane, click the drop-down arrow and select Create Calculated Field.

๐Ÿ‘ Screenshot-2026-02-04-130627
select create calculated field

2. Keep the name the field as Index and enter the following formula - INDEX() and Click OK.

๐Ÿ‘ Screenshot-2026-02-04-150012
Index calculated field

Step 3: Sort Genres in Descending Order

Select the Genre field in the view and click the Sort Descending button from the top toolbar.

๐Ÿ‘ Screenshot-2026-02-04-150221
click this tool to sort in descending order

This ensures genres are ordered based on Global Sales.

Step 4: Display Index Values

1. Right-click on the Index field and select Convert to Discrete.

๐Ÿ‘ Screenshot-2026-02-04-150516
select Covert to Discrete

2. Drag and drop the Index field to the sheet before the Genre field.

๐Ÿ‘ a
Index field next to Genre field

Step 5: Highlight Top 3 Genres

1. Create a new calculated field and name it Top 3. Enter the formula - [Index] < 4 and click OK.

๐Ÿ‘ b
Name it Top3 and enter the value and click ok.

2. Drag and drop the Top 3 field to Color in the Marks card.

๐Ÿ‘ c
put Top3 field in Color

3. This highlights the top 3 genres with a different color.

๐Ÿ‘ d
Top 3 genre highlighted with yellow color

Step 6: Identify Bottom Values Using LAST()

1. Create another calculated field and name it Last. Enter the formula - LAST() and click OK.

๐Ÿ‘ e
Name it Last and enter the value and click ok.

2. Right-click on the Last field and select Convert to Discrete.

๐Ÿ‘ f
select Covert to Discrete

3. Drag and drop the Last field to the sheet next to the Genre field.

๐Ÿ‘ g
Last field next to Genre field

Step 7: Highlight Top 2 and Bottom 2 Genres

1. Create a new calculated field named Top2 and Bottom2. Enter the following formula - [Index] < 3 OR [Last] < 3 and click OK.

๐Ÿ‘ h
Name it Top2 and Bottom2 and enter the value and click ok.

2. Drag and drop Top2 and Bottom2 to the Color shelf in the Marks card.

๐Ÿ‘ i
Top2 and Bottom2 field to Color

This applies conditional formatting to highlight both the top 2 and bottom 2 genres using different colors.

Final Output

After completing all the steps, you will have a conditionally formatted table where:

  • Genres are sorted by Global Sales
  • Index values indicate ranking position
  • Top 3, Top 2 and Bottom 2 genres are highlighted using colors
  • Important values stand out instantly for analysis
๐Ÿ‘ conditionalformatting
Conditional Formatting

This conditional formatting technique helps in quick comparison, ranking analysis and creating clean, insight-driven Tableau dashboards.

Comment
Article Tags:
Article Tags:

Explore