Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
elenarelinque
Creator
Creator

Condicionales/Conditionales

Estoy intentando categorizar rangos de hora y clasificarlos en turnos, de tal manera que :

Mañana: 07.00-15.00

Tarde: 15.00-23.00

Noche: 23.00-7.00

Esto indicando esto, pero el de la Noche me lo deja en blanco:

 

IF(Hour("FECHA_FABRICACION") >= 7, IF(Hour("FECHA_FABRICACION") <= 15,'M',IF(Hour("FECHA_FABRICACION") > 15, IF(Hour("FECHA_FABRICACION") <= 23, 'T', 'N'),'N'))) as TURNO

 

I am trying to categorize hour ranges and classify them in shifts, in such a way that :  

Morning: 07.00-15.00

Afternoon: 15.00-23.00

Night: 23.00-7.00

This is my expression, but the Night one leaves it blank: IF(Hour("DATE_MANUFACTURING") >= 7, IF(Hour("DATE_MANUFACTURING") <= 15,'M',IF(Hour("DATE_MANUFACTURING") > 15, IF(Hour("DATE_MANUFACTURING") <= 23 , 'T', 'N'),'N'))) as TURN

 

Labels (4)
1 Solution

Accepted Solutions
Bunim
Contributor III
Contributor III

IF(Hour("DATE_MANUFACTURING") >= 7 and Hour("DATE_MANUFACTURING") <15,'M',
IF(Hour("DATE_MANUFACTURING") >= 15 and Hour("DATE_MANUFACTURING") <23,'T',
IF(Hour("DATE_MANUFACTURING") >= 23 or Hour("DATE_MANUFACTURING") < 7,'N',
))) as TURN

 

View solution in original post

2 Replies
Bunim
Contributor III
Contributor III

IF(Hour("DATE_MANUFACTURING") >= 7 and Hour("DATE_MANUFACTURING") <15,'M',
IF(Hour("DATE_MANUFACTURING") >= 15 and Hour("DATE_MANUFACTURING") <23,'T',
IF(Hour("DATE_MANUFACTURING") >= 23 or Hour("DATE_MANUFACTURING") < 7,'N',
))) as TURN

 

elenarelinque
Creator
Creator
Author

It works! Thank you so much!