Alteryx Designer Desktop Discussions

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

How to Create a Time Range column in Alteryx?

Vishz14
5 - Atom

Hii Team,

I hope you are doing well.

Following is my data:

Vishz14_0-1685012965805.png


I want to make a new column as a period in the dataset with the following range and conditions based on the time value mentioned in the departure time column:

1) Early Morning is (4:00 to 7:59) 
2) Morning is (8:00 to 11:59)
3) Mid-day (12:00 to 15:59)
4) Evening (16:00 to 19:59)
5 Night (20:00 to 23:59)

Any help will be appreciated. Thank you in advance.

 

3 REPLIES 3
RSreeSurya
9 - Comet

Hello,

 

Please refer below formula and sample output.

 

if [Departure Time]>='04:00:00' and [Departure Time]<= '07:59:00' then 'Early Morning' elseif [Departure Time]>='08:00:00' and [Departure Time]<= '11:59:00' then 'Morning' elseif [Departure Time]>='12:00:00' and [Departure Time]<= '15:59:00' then 'Mid-day' elseif [Departure Time]>='16:00:00' and [Departure Time]<= '19:59:00' then 'Evening' elseif [Departure Time]>='20:00:00' and [Departure Time]<= '23:59:00' then 'Night' else '' endif

 

RNSupraja_0-1685016435745.png

 

Kenda
16 - Nebula
16 - Nebula

Hi @Vishz14 

 

I would recommend creating a Text Input with your categorization table like you have above. Include one field for start time, one field for end time, and the name of the category. You can then use an Append tool to attach this to your set of data. Finally, use a Filter tool to only keep where your Departure Time is >= the start time and Departure Time is <= the end time. This should get you what you're looking for.

 

Kenda_0-1685016652719.png

 

Vishz14
5 - Atom

Hii Team, Thank You so much for the help. The solution really helped.

Labels