Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I want Day & Night Employee Shift time in QV

Hi,

I want Day flag & Night flag

My Day Shift Starts :

9.00 AM to 7.00 PM

My Night Shift Starts :

7.01 PM to 8.59 AM

Please send me script level code of this as soon as possible.

If i select Day : All records which lies in day shift is should come in DAY.

If i select Night : All records which lies in Night shift is should come in Night.

Regards

1 Solution

Accepted Solutions
sunny_talwar

Or this:

If(Frac(FieldName) >= MakeTime(9) and Frac(FieldName) <= MakeTime(19), 'Day', 'Night') as Flag

View solution in original post

7 Replies
Kushal_Chawda

Can you share the sample data?

sunny_talwar

May be create a flag in your fact table:

If(Hour(FieldName) >= MakeTime(9) and Hour(FieldName) <= MakeTime(19), 'Day', 'Night') as Flag

If(Hour(FieldName) >= MakeTime(9) and Hour(FieldName) < MakeTime(19), 'Day', 'Night') as Flag

sunny_talwar

Or this:

If(Frac(FieldName) >= MakeTime(9) and Frac(FieldName) <= MakeTime(19), 'Day', 'Night') as Flag

Not applicable
Author

Do you require QVDs used data or Report data.

Kushal_Chawda

Just need to understand how your data look like and on what field you want to do the calculation? You can show the screenshot of your sample QVD data

prees959
Creator II
Creator II

Hi,

Could I use this expression to create an Early, Late and Night Shift where the Early Shift runs from 08:00 to 13:59, Late runs from 14:00 to 19:59 and night runs from 20:00 to 07:59?

Many thanks,

Phil

sunny_talwar

May be like this

If(Frac(FieldName) >= MakeTime(8) and Frac(FieldName) < MakeTime(14), 'Early',

If(Frac(FieldName) >= MakeTime(14) and Frac(FieldName) < MakeTime(20), 'Late', 'Night')) as Flag