Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

MOD function

PNC97
8 - Asteroid

I'm working on math where  

 

if [Running Sum] >[sch-work] then (if [sch-work] = 0 then [Running Sum] else Number.Mod([Running Sum],[#"sch-work"])) else 0),

 

I tried by this below formula

 

IF [Running Sum] >[sch-work]
THEN
If [sch-work] = 0 THEN [Running Sum]
ELSE Mod([Running Sum],[sch-work]) ENDIF

ELSE 0 ENDIF

 

But I didn't got the expected output 

 

Prudhvinath_Chowdary_0-1623095183334.png

 

 

If possible can you help with the workflow or logic to be used

 

5 REPLIES 5
apathetichell
19 - Altair

I'm fairly sure mod returns an integer. So all of those are going to be rounded to zero. You can test this by adding a number greater than 7 and seeing that the result is 1.

 

if you want to get the mod of that try this:

[Running Sum]-(floor([Running Sum]/[sch-work])*6)

PNC97
8 - Asteroid

Yes it is rounding to 0.

 

But is there any luck to get the double (type) output same as excel 

apathetichell
19 - Altair

see my formula above - I'd use that as a workaround.

 

this is what R says about Modulo btw:

Error in mod(6.11116, 6) :
Arguments 'n', 'm' must be integers or vectors of integers.

Qiu
21 - Polaris
21 - Polaris

@PNC97 

Looks like you have already an answer and just to add and try to be more dynamic.

Qiu_0-1623105923806.png

Capture1A.PNG

 

sherinamahtani
7 - Meteor

Check out my solution!

Labels