Alteryx Designer Desktop Discussions

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

Modulo and decimals

CowCookie
6 - Meteoroid

Is there a way to get the mod function to be something besides an integer? I'm trying to identify dollar amounts that end in regular values, but I get 0 for both mod(200, 100) and mod(200.91, 100). I realize I could always just multiply both by 100 (ie. mod(20091, 10000) would not equal 0), but that seems an awfully cumbersome way to go about it. Am I missing something?

3 REPLIES 3
KevinP
Alteryx Alumni (Retired)

@CowCookie You aren't missing anything. As per the help documentation (https://help.alteryx.com/current/Reference/Functions.htm?Highlight=modulo) the modulo function is an integer only operation. However, you could write your own formula to achieve the same result for floating point numbers if necessary.

MarqueeCrew
20 - Arcturus
20 - Arcturus
How about:

Regex_match(ToString([amount]),"\d+00")

Will that do what you need?

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 @CowCookie 

 

Another way to do it is this formula

 

floor(Abs([Field1])) = abs([Field1])

 

which compares the absolute value of the integer portion of the number with the absolute value of the value.  the Abs() is to get around the fact floor(N) always gives you the closest integer <= N and for negative values give you the next integer value  i.e. Floor(-2.1)=-3.  

 

Dan

Labels