Conditional Formatting in Table Tool

Conditional Formatting in Table Tool

Conditional formatting is a very effective way of pointing out values in analyses that should be looked at particularly closely. In Excel, many people use this option very intensively - the result looks like this, for example:

Es wurde kein Alt-Text für dieses Bild angegeben.

However, even though this is very easy to implement in Excel, there are good reasons to create reports that are needed regularly with Alteryx. The report shown above could look something like this created using Alteryx:

Es wurde kein Alt-Text für dieses Bild angegeben.

But how do you get from the data supplied to this report? Of course, there is no COPY-PASTE here, but a workflow in which data is loaded and prepared.

To output the report, we use the Table Tool, which can also be used as a module in more complex reports. It might look something like this. 

Es wurde kein Alt-Text für dieses Bild angegeben.

Data is loaded from a file, a few calculations are performed (in our example only a total row) and then the report is generated. Of course, the report should look exactly like our Excel template, i.e. it should also highlight the "anomalies".

Here, the Table tool helps us to design the report accordingly, i.e. to select columns, change their order or adjust headings. And there are a number of column-related formatting options that we can use for our report.

Es wurde kein Alt-Text für dieses Bild angegeben.

If we select one of the columns under "Per Column Configuration", we can access the column rules of the selected column with "Create ...", i.e. specific formatting rules that only apply to this column.




Es wurde kein Alt-Text für dieses Bild angegeben.

When opened for the first time, a new rule is automatically created, which then only needs to be filled with content (i.e. specific instructions).

Es wurde kein Alt-Text für dieses Bild angegeben.

I would recommend changing the "Rule Name" immediately. Here I have adapted the name of the rule to the target colour - so it follows the rule with which the cells are to be marked whose values are particularly bad. Of course, "Rule 1", "Rule 2" etc. are also possible, but who remembers after a few weeks what is hidden behind "Rule 5"?

In the next step you decide when to apply the rule (i.e. the formatting) - always or only in certain cases. So there is no difference between "general formatting" and "conditional formatting", but the column rules are used for both cases. If a column should always have a certain font or colour, this is also specified here - in this case, the rule always ("Apply Always") is applied. In our case, we can select "When" (i.e. use a simple condition); if this is not enough, there is also the option of using a formula as a condition.

With a simple condition, as used here, we must then select the column to which it should apply (3), specify the type of comparison (4) and the value to be checked against (5). 

For the example, we choose the deviation column, "<=" and "-25" as the limit value.

Important: Not only numerical checks are possible, but also checks for a specific text. 

Es wurde kein Alt-Text für dieses Bild angegeben.

Then it must be determined what should happen when the condition is fulfilled. A wide range of options is available here - font type and size, colour, but also prefix and suffix, for example.

In our case, we select "Background Color" and then specify the color using the corresponding selection mask.

Es wurde kein Alt-Text für dieses Bild angegeben.

After you have confirmed the selection, we see our first rule again in the summary. When we exit the rule, the Table Tool no longer shows "Create" for the column rules, but now "Edit" - a rule already exists.

Es wurde kein Alt-Text für dieses Bild angegeben.

The result meets our expectations: The cell that shows a variance of -40.5% (i.e. <= -25) is highlighted in red. So it seems to work.

Important: The condition does not have to refer to the column that is to be formatted! We could have colored the first column, for example.

Then we can continue. Let's just add a condition that covers the next range - the deviation up to -10%. Then we follow the same procedure as before - adjust the name of the rule, select the column to be checked, enter the comparison operator and the limit value and select the color.

Es wurde kein Alt-Text für dieses Bild angegeben.

This time, however, it does not work quite as intended - now two fields are highlighted in light red, and the formatting already set in the first rule is "destroyed" again by the second.

Es wurde kein Alt-Text für dieses Bild angegeben.

The reason for this is that the rules are simply executed in the order in which they are listed, regardless of whether a previous rule has already been applied. Of course -40.5 is smaller than -25 - but it is also smaller than -10! The formatting of the last applicable rule therefore overwrites all preceding rules.

Important: Only the specified formats are overwritten. If we had chosen "bold" in addition to "red", but only specified "light red" in the second rule, "bold" would have been retained.

Of course, it is simpler and more practical to use the "correct" order directly. With "Up" and "Down" the rules can be moved. Ranges (i.e. "value between -10 and -25") can alternatively also be checked with a formula.

But even so - after changing the order, it works as planned.

Es wurde kein Alt-Text für dieses Bild angegeben.

Now only a few more rules are missing, then the formatting looks like in the Excel sheet. 

Es wurde kein Alt-Text für dieses Bild angegeben.

But stop - the totals line was still bold in the original,

For this purpose, there are the "Row Styling Rules". Basically, they work like column rules, but they refer to one row. We can either define them (a specific row number) or identify them via the label "Total" - which is more flexible. 

Es wurde kein Alt-Text für dieses Bild angegeben.

Important: If the rules of column and row formatting do not match, the column rule has priority - unless it is defined differently in the row rule! 

Es wurde kein Alt-Text für dieses Bild angegeben.

Anyway, our report now looks like the Excel template! 

Es wurde kein Alt-Text für dieses Bild angegeben.

By the way, the Table Tool also offers a whole range of other formatting options that you should definitely have a look at.

In this way, a "semi-manual" report can be quickly and easily converted into an automatic process that is always repeatable and remains scalable.


#AlteryxAdventCalendar #alteryxace #alteryxinnovator #analytics

To view or add a comment, sign in

More articles by Roland Schubert

  • Time For Summary

    When I receive a new table or file, I always try to first get an overview. Usually by bringing an INPUT DATA tool onto…

  • A Little Bit More: Oversampling

    When selecting data records, it is often simply a matter of selecting only the first (or last) data from a table…

    1 Comment
  • Building Groups Based on Relations

    Grouping is not necessarily a very unusual task - customer groups always come to my mind spontaneously. Common…

  • Different Types of Correlation

    I have to admit it - I intuitively tend to look for relationships between different data. And indeed, I often recognize…

  • Grouping Data

    Grouping data in some way is an essential part of day-to-day business for data analysts. Many people immediately think…

  • Comparing To Lists

    Long years ago, a DIY chain in Germany launched a discount campaign entitled "20% discount on all items - except pet…

  • Famous (or Not-So-Famous) Last Words

    Sometimes you just have to have the last word - the last word from a text field, of course. When it comes to "breaking…

    1 Comment
  • Break on Error

    An error has occurred in a workflow and it continues to run anyway? Sometimes that's all right, but only sometimes…

  • Year-To-Date Calculations

    If you are working in Finance/FP&A/Controlling, calculating "Year to Date" (YTD) values is an essential part of your…

  • Compare Date and Time

    We often need data only for a specific period of time - a year, a month or a week, sometimes just a few hours, but the…

Others also viewed

Explore content categories