Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power BI Table Alternate Row Color: Step-by-Step

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To give a Power BI table alternating row colors, you use the table visual's style presets or a conditional format rule based on a row number. The quickest route is to select the table, open the Format pane, and switch on the banded rows style preset; for full control over the two colors, add an index column in Power Query and apply a conditional background color rule with the MOD function. This guide covers both methods, plus the mistakes that make banding fail.

What You'll Need

  • Power BI Desktop (the banding controls are not available in the Power BI service editing view).
  • A table visual already placed on a report page with at least one field in the Values area.
  • For the custom-color method: permission to edit the query (Power Query Editor) or a DAX-capable model.
  • Basic familiarity with the Format pane and the Fields/Values well.

Step-by-Step

  1. Select the table visual. Click anywhere inside the table on the canvas so the Format pane appears on the right. If the pane is collapsed, click the paint-roller icon.
  2. Open the style presets. In the Format pane, expand Style presets (in newer versions it may sit under Visual > Style presets). Labels vary slightly by version and region.
  3. Turn on banded rows. In the Style presets section, set Banded rows to On. Power BI applies alternating shading using the theme's default colors. This is the fastest method and requires no data changes.
  4. Adjust the colors (optional). With banded rows on, expand Grid > Row padding and Grid > Alternating background if your version exposes those controls. If your version does not show a color picker for banding, use the conditional-format method below.
  5. For custom colors, add a row index. Go to Home > Transform data to open Power Query Editor. Select your table query, then Add Column > Index Column > From 0 (or From 1). Click Close & Apply.
  6. Create a measure for the band color. In the Data pane, right-click your table and choose New measure. Enter a DAX expression such as: Row Band = IF ( MOD ( SELECTEDVALUE ( 'Table'[Index] ), 2 ) = 0, "#FFFFFF", "#F2F2F2" ). Replace 'Table' and [Index] with your actual table and column names.
  7. Apply conditional formatting. Select the table visual, open the Format pane, expand Cells > Background color, click the fx (conditional formatting) button, set Format style to Field value, and choose your Row Band measure. Click OK.
  8. Test the result. Scroll the table and confirm rows alternate. If the shading does not appear, check that the Index column is included in the query and that the measure returns a valid hex color.

Common Mistakes

  • Using a column that repeats values. Banding based on a category (like Region) shades whole blocks rather than alternating rows. Always use a unique row index.
  • Forgetting to refresh the query. If you add the Index column but do not click Close & Apply, the measure cannot see it.
  • Applying formatting to the wrong visual. Conditional formatting is per-visual. If you copy the table, reapply the rule.
  • Expecting banding in the Power BI service. Style presets and conditional formatting are authored in Desktop; the service renders what you published but does not offer the same editing controls.
  • Using a measure that returns text without a valid color. Hex codes must start with # and be six characters, or Power BI ignores them.

Tips

  • Keep banding subtle: a light gray like #F2F2F2 against white reads well and does not fight the data.
  • If your table has a total row, banding may shade it too. Exclude totals by adding a condition to the measure, or turn banding off for that row using a separate rule.
  • For matrix visuals, banding works differently because of row hierarchies; test with a small dataset first.
  • Save your color choices as a custom theme (View > Themes > Customize current theme) so every table in the report matches.

Troubleshooting

Banded rows toggle is grayed out. Confirm you have selected the table visual, not the page background. If it remains grayed out, your version may not expose the toggle; use the conditional-format method.

Colors do not alternate. Open the measure in DAX Studio or a card visual and check it returns two different hex values. A common cause is SELECTEDVALUE returning blank because the Index column is not in the visual's filter context.

Banding disappears after publishing. The service renders conditional formatting, but if the measure references a column not included in the published model, it fails silently. Republish after adding the column.

Performance slows on large tables. Conditional formatting on every row can be heavy. Prefer the style preset for large datasets, or limit the table to fewer rows with a Top N filter.

If that did not work, delete the visual and rebuild it, then reapply the rule. Corrupted visual settings occasionally persist after version updates.

Frequently Asked Questions

Can I alternate row colors without adding an index column?

Yes, using the Style presets banded rows toggle. It uses the theme's default colors and does not require any data changes.

Does banding work in the Power BI service?

You author it in Power BI Desktop. The service displays the banding you published but does not offer the same style preset controls for editing.

Can I use three colors instead of two?

Not with the built-in banding. You can approximate it with a DAX measure that returns three hex values based on MOD ( [Index], 3 ), applied as a background color rule.

Why does my banding shade groups of rows instead of single rows?

Your rule is likely based on a column that repeats values. Switch to a unique index column so each row gets its own value.

Does banding affect export to Excel or PDF?

Yes, the shading is included when you export the visual from the service or Desktop, provided the conditional formatting rule is valid at export time.

Can I apply banding to a matrix visual?

Matrix visuals support banded rows through style presets, but conditional formatting behaves differently because of row hierarchies. Test with a small dataset before applying it to a large model.