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

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

Twitter

LinkedIn

Author:
Henry Mak
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab