Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula Issues

Riot
8 - Asteroid

I have time variable. It goes from 0-23. I want to parse it into categories. If 22,23, 0, 1,2 ,3 than 1, If 4,5,6,7,8,9 than 2, if 10,11,12,13,14,15 than 3 if 16,17,18,19,20,21 than 4. 

I have trouble writing forumlas with multiple posible outputs. Any advice would be great. 

2 REPLIES 2
danielbrun2
ACE Emeritus
ACE Emeritus

Hi,

The formula should look something like this:

 

IF [variable] IN (22,23,0,1,2,3) THEN 1
ELSEIF [variable] IN (4,5,6,7,8,9) THEN 2
ELSEIF [variable] IN (10,11,12,13,14,15) THEN 3
ELSEIF [variable] IN (16,17,18,19,20,21) THEN 3
ELSE 0
ENDIF

 

I have also attached a example workflow.

 

Have a nice weekend,

Daniel

 

jdunkerley79
ACE Emeritus
ACE Emeritus

Can easily be done using the MOD and Floor function:

Floor(Mod([Hour]+2,24) / 6) + 1

Attached as a workflow as well

Labels
Top Solution Authors