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: 
Not applicable

Frac() function

Hi Experts,

i m trying to create a field with the following If condition.

IF(FRAC(TIMESTAMP) >'06:30:00' and FRAC(TIMESTAMP)<='18:30:00','06:30 - 18:30',     

IF(FRAC(TIMESTAMP) >'18:30:00' and FRAC(TIMESTAMP)<='06:30:00','18:30 - 06:30',
IF(FRAC(TIMESTAMP) >'06:45:00' and FRAC(TIMESTAMP)<='18:45:00','06:45 - 18:45',
IF(FRAC(TIMESTAMP) >'18:45:00' and FRAC(TIMESTAMP)<='06:45:00','18:45 - 06:45')))) AS  SHIFTHOURS


I m expecting to get the field values as:

SHIFTHOURS:

06:30 - 18:30

18:30 - 06:30

06:45 - 18:45

18:45 - 06:45


But my actual results are

06:30 - 18:30

06:45 - 18:45



I m missing two more values in the field. Am i doing anything wrong?


can someone please help me to correct the expression?

10 Replies
PrashantSangle

Hi,

You want output like this manner then  if else wont help you

Try with Switch case when.


Syntax :

switch expression { case valuelist [ statements ]} [ default statements ]end switch


Search in help menu for details.

Regards,

Prashant

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂