Modulo: Checking whether a number is odd or even (Tableau & Alteryx)

by Henry Mak

As described in my previous blog post, the method used is an application of the modulo operator.

The Logic

In order to check whether a number is odd or even we have to look at the remainder when the number is divided by 2. More specifically we have to check if the remainder is not equal to 0. If it is not equal to 0 then it is odd and when it is equal to zero then it is even.

There are alternatives but we have to be careful of the common pitfalls.

Tableau

In order to work out if a Number is odd or even, you have to create the following calculated field:

For a given set of Numbers, this is the output shown in the Data Source tab:

Alteryx

To work out whether a Number is odd or even in Alteryx, we have to create something similar with a Formula tool:

For a given set of Numbers, this is the output:

As we can see, the results is as we expect and is consistent across both Tableau and Alteryx. Good times.

Link to all of my other blog posts on the Modulo operation

Tableau Public