Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Using Boolean statements with DateTime

adarchuk
7 - Meteor

I'm trying to add labels to timestamps.  I would like any time from 04:45 to 16:44 to be labeled DAYS for day shift.  Any time from 16:45 to 04:44 to be labeled NIGHTS for night shift.  I was able to get my formula to work for 05:00 to 17:00 because I only entered hours.  Now that I want to add minutes my formula does not work.

 

DateTimeHour([Date and Time_Act])

 

DateTimeMinutes([Date and Time_Act])

 

IIF(([Hour_Act]<4 AND [Minute_Act]>44)
OR ([Hour_Act]>16 AND [Minute_Act]>44),
"NIGHTS","DAYS"))

 

adarchuk_0-1648731763717.png

 

2 REPLIES 2
Luke_C
17 - Castor

Hi @adarchuk 

 

I think you have an extra parenthesis at the end. Try this

 

IIF(([Hour_Act]<4 AND [Minute_Act]>44)
OR ([Hour_Act]>16 AND [Minute_Act]>44),
"NIGHTS","DAYS")

 

adarchuk
7 - Meteor

Such a simple solution!  Thanks for your help.

Labels