Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am having #ShiftStartTime/#ShiftEndTime of a Employee say XYZ.
I want to show total no. of hours of XYZ from this time measure. I am using sum(#ShiftEndTime-#ShiftStartTime) but its not working.
Can some body suggest to me what I can do in this case?
Regards,
Balraj
Hi,
What exact result gives your expression?
'-' or '0,12312' or smth else.
Try
Interval( sum(#ShiftEndTime-#ShiftStartTime) )
Regards,
Andrei
Hi,
Try like this
Load
*,
Num(Interval(ShiftEndTime - ShiftStartTime, 'h')) AS Hours
FROM DataSource;
Now use this expression
=Sum(Hours)
Regards,
Jagan.
Hello Andrei,
Its not working, still its giving 1 with your expression else 0.
Regards,
Balraj
What is the time format in #ShiftEndTime and #ShiftStartTime?
Hi
It depends on what you actually have in these two fields (the underlying value, not the displayed value). If they are normal date/time/timestamp fields, then the time portion is a fraction of a day. To get the interval in hours (not just display in hours), use
(#ShiftEndTime-#ShiftStartTime) * 24 (in hours)
(#ShiftEndTime-#ShiftStartTime) * 1440 (in minutes 1440 = 24*60)
To display in hh:mm (the underlying value does not change, just the display format) use:
interval((#ShiftEndTime-#ShiftStartTime) * 24, 'hh:mm')
HTH
Jonathan
Can you share a qvw sample?
Andrei
Hello Jagan,
Will it work for minutes?
Regards,
Balraj
Jonathan,
Time is into 24 hr format, but your expression is not working.
Regards,
Balraj
Hi,
Try like this for minutes
Load
*,
Num(Interval(ShiftEndTime - ShiftStartTime, 'm')) AS Minutes
FROM DataSource;
Now use this expression
=Sum(Minutes)
Regards,
Jagan.