We’ve extended Inspire Early Bird Pricing until March 1. Register now and enjoy 20% off conference passes and 10% off training passes. P.S. Don’t forget to bring friends! When you sign up for five or more tickets, you get an extra 20% discount on conference passes. Learn more now.

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
6 - Meteoroid

Have you ever had a table where you wanted to use odd/even row coloring, but wanted the grouping to vary based on the data? Perhaps you have a field in your data like this:












It would be nice if you could have all of the "1" rows white, the "2" rows gray, and so on. With the new Table Rules feature in Alteryx 4.1, accomplishing this is a snap!

Table Rules allow you to override any of the standard (or even not so standard) styles used in tables. You can do this for individual rows, columns, or cells. You get to specify a condition for when the override should happen, and then what styles to override. You can create any number of rules for a table.


In the following example, I wanted to alternate the background color for the rows whenever the City field changed. I accomplished this by using the Tile tool, which assigned a unique value to each City. I then used two rules to override the background color in the table, one which changed the color for odd-numbered tiles, and one for even-numbered tiles. You can download the module here.


Here is the result:


This is a Basic table with default odd/even coloring. Although the original data is sorted alphabetically by the School Name, we pass the data through a Sort tool keyed to the City field, and use the default odd/even coloring settings in the table.


This is a Basic table which uses the new Row Rules feature to alternate colors when the name of the city changes. This is accomplished by using a Tile tool, and setting it to Unique Value and choosing the City field. This assigns each item a Tile_Num field, with each City getting its own value. We will use this value to override the odd/even coloring.


We add two Row Rules to the table, as follows:

Apply Formula: Mod([Tile_Num], 2) == 1

Style: Background Color: White


Apply Formula: Mod([Tile_Num], 2) == 0

Style: Background Color: 240,240,240


The Mod() function divides the Tile_Num value by 2 and returns the remainder. For odd values, this returns 1. For even values, this returns 0. Thus the two rules each apply to their respective rows.