Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I am a new Qlikview user so I guess my issue might seem easy to you but I need your help with a report I have where I need to create 2 selection buttons one for the morning shift and the other for the night shift so when I click on the morning shift button I get the information and graphs for the data that took place within the morning shift interval which is between 5AM till 4:59 PM and the same for the night shift which starts at 5 PM and ends the next day at 4:59 AM.
the challenge here is with the night shift as it is taking place in 2 different days (5PM till 12 AM and the next day from 12 AM till 4:59AM)
I tried the daystart function but I couldn't make it work.
So could you please advise what should I do to solve this?
Hi,
I think former proposed solution meets you requirement to distinguish between morning and night shifts (you just asked for two buttons to do so).
Your requirement to distinguish between individual consecutive shifts is different from your initial question and might be implemented e.g. like this:
tabIncidents:
LOAD *,
Dual(Shift&' '&ShiftDate, ShiftStart) as ShiftName;
LOAD *,
DayName(ShiftStart) as ShiftDate,
If(Time<'05:00' or Time>='17:00','Night','Morning') as Shift;
LOAD *,
Time#(Time(Frac(DateTime),'hh:mm'),'hh:mm') as Time,
Timestamp(Floor(DateTime,'12:00','05:00'),'MM/DD/YYYY hh:mm') as ShiftStart;
LOAD RecNo() as IncidentID,
Timestamp#(Timestamp(Floor(Now()-Rand()*10,1,NORMINV(Rand(),'12:00','04:00')),'MM/DD/YYYY hh:mm'),'MM/DD/YYYY hh:mm') as DateTime
AutoGenerate 10000;
hope this helps
regards
Marco
Its tough to answer this without know what your data looks like.
Hi,
Assuming your date is in timestamp format M/D/YYYY h:mm:ss[.fff] TT.
you can use the below logic:
If(Frac(Date) >= MakeTime(5) and Frac(Date) <= MakeTime(17), 'Day', 'Night') as Flag
Refer this thread for more information
https://community.qlik.com/thread/213240
Hope this helps
Thanks,
Pooja
Well, I have a field with the timestamp (date/time) and have a field with tickets numbers and I' trying to display the incident for each shift
Thank you Pooja.
I'll try it
it shows the morning shift correctly but the night shift is showing the tickets from 0 till 5 AM and from 5 PM till 12 of the same day which is not correct.
Hi,
I think former proposed solution meets you requirement to distinguish between morning and night shifts (you just asked for two buttons to do so).
Your requirement to distinguish between individual consecutive shifts is different from your initial question and might be implemented e.g. like this:
tabIncidents:
LOAD *,
Dual(Shift&' '&ShiftDate, ShiftStart) as ShiftName;
LOAD *,
DayName(ShiftStart) as ShiftDate,
If(Time<'05:00' or Time>='17:00','Night','Morning') as Shift;
LOAD *,
Time#(Time(Frac(DateTime),'hh:mm'),'hh:mm') as Time,
Timestamp(Floor(DateTime,'12:00','05:00'),'MM/DD/YYYY hh:mm') as ShiftStart;
LOAD RecNo() as IncidentID,
Timestamp#(Timestamp(Floor(Now()-Rand()*10,1,NORMINV(Rand(),'12:00','04:00')),'MM/DD/YYYY hh:mm'),'MM/DD/YYYY hh:mm') as DateTime
AutoGenerate 10000;
hope this helps
regards
Marco
Thank you marcowedel
It's so impressive.
I'm glad you like it.
Please close your thread if your question is answered:
Qlik Community Tip: Marking Replies as Correct or Helpful
thanks
regards
Marco