Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

This widget could not be displayed.

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
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

This widget could not be displayed.
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

This widget could not be displayed.
7 Replies
Kushal_Chawda

Can you share the sample data?

This widget could not be displayed.
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

This widget could not be displayed.
sunny_talwar

Or this:

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

This widget could not be displayed.
Not applicable
Author

Do you require QVDs used data or Report data.

This widget could not be displayed.
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

This widget could not be displayed.
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

This widget could not be displayed.
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

This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.