Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
How to Calculate the difference between timestamp in hrs. when my table is in the form of
CaseId PriorityId StageId Time
1 1 1 1/1/2013 11:08:00 AM
1 1 2 1/1/2013 11:20:00 AM
1 1 3 1/1/2013 12:20:00 AM
Now i need to make a chart where my dimension is a drill down of PriorityId and StageId and in expression i need to calculate the StageId wise expression,
Like for stage Id =1 then in expression the difference between Time of stageId 2 and Time of StageId 1.
and for stage Id =2 then in expression the difference between Time of stageId 3 and Time of StageId 2.
Thanks and Regards.
Hi,
Try this script
Temp:
LOAD
CaseId,
PriorityId,
StageId,
Timestamp(Timestamp#(Time, 'M/D/YYYY hh:mm:ss TT'), 'M/D/YYYY hh:mm:ss TT') AS Time
INLINE [
CaseId, PriorityId, StageId, Time
1,1,1,1/1/2013 11:08:00 AM
1,1,2,1/1/2013 11:20:00 AM
1,1,3,1/1/2013 12:20:00 AM ];
Data:
LOAD
CaseId, PriorityId, StageId,
Time,
Interval(Previous(Time) - Time, 'hh') AS Hours
RESIDENT Temp
ORDER BY StageId Desc;
DROP TABLE Temp;
Regards,
Jagan.
Hi Jagan,
Don't you think that calculation of hours is
Interval(Time - Previous(Time) , 'hh') AS Hours
instead of
Interval(Previous(Time) - Time, 'hh') AS Hours.