Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Filter for whole numbers

danchips24
7 - Meteor

Hi,

 

I am trying to create a custom filter that will remove all decimals and keep only whole numbers. I have tried the following formula based on a post I saw in the community but it keeps telling me that it is a malformed function call:

 

REGEX_Match([Sum_ENTERED_DR], \d+)

 

can someone please assist?

 

Thanks!

6 REPLIES 6
Thableaus
17 - Castor
17 - Castor

Hi @danchips24 

 

Just quote your  expression and you will be fine.

 

Also, make sure your field is considered as a String if it is not.

 

REGEX_Match(ToString([Sum_ENTERED_DR]), "\d+")

 

 

Cheers,

MarqueeCrew
20 - Arcturus
20 - Arcturus
REGEX_Match([Sum_ENTERED_DR], "\d+")

 

Assuming that the sum_entered_dr field is a string.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
danilang
19 - Altair
19 - Altair

Hi @danchips24 

 

If your field is numeric, you can use this

floor([Field1])=[Field1]

Does the integer portion of the number = the number 

 

Dan

 

DiganP
Alteryx Alumni (Retired)

@danchips24 You can also do the below in the filter tool.

!Contains(tostring([Field1]), '.')

Keeping it simple 🙂 

Digan
Alteryx
Thableaus
17 - Castor
17 - Castor

@danchips24 

 

Last but not least.

Good option - IsInteger function.

 

IsInteger([Field]) on Filter tool. 

 

Cheers,

danilang
19 - Altair
19 - Altair

@Thableaus 

 

IsInteger() - Built in Alteryx function.  Definitely the best option! 

 

Another hidden gem in the Test group of functions is 

 

CompareEpsilon(a,b,epsilon)   Used to compensate for the inaccuracies introduced with trying to represent base 10 decimals in Base 2

 

Dan

 

Labels