4 Replies Latest reply on Feb 16, 2016 11:22 AM by Sajid R

# Time Calculations

I have data in following format

ID
State
TIme
12START11/2/2015 11:14:00 PM
12ACTIVE11/2/2015 11:14:03 PM
12NOT ACTIVE11/2/2015 11:14:45 PM
12ACTIVE11/2/2015 11:14:48 PM
12END11/2/2015 11:14:50 PM

i have many IDs with the states and I need to create a PIE chart that shows distribution of total seconds all the IDs were active and total seconds all were not active.

How can I achieve this ?

Thanks,

Sajid

• ###### 1. Re: Time Calculations

Quite difficult to define the logic with given information.

How many "Active" and "Not Active" are expected between Start and End?

If those are only one "Not active" and "two Active", the logic si relatively easy, but if those are really depends up to ie) 5 or so, we need have other "State"  definition,

such as Active 1 & Not Active 1 etc,

Thanks,

Shin

• ###### 2. Re: Time Calculations

Hello Sajid

Require some more details

1. From START to 1st ACTIVE what will be the status? ACTIVE or NOT ACTIVE?

2. FROM 2nd ACTIVE to END what will be the status? ACTIVE?

AS per my understanding

ACTIVE sec = (11:14:45 - 11:14:03) = 42 Sec

NOT ACTIVE sec= (11:14:48 - 11:14:45) = 3 Sec

OR

ACTIVE sec = (11:14:45 - 11:14:03) = 42 Sec + (11:14:50 - 11:14:48) = 2 Sec

So the total ACTIVE sec = 44 sec

NOT ACTIVE sec= (11:14:48 - 11:14:45) = 3 Sec + (11:14:03 - 11:14:00) = 3 sec

So the total NOT ACTIVE sec = 06 sec

Please confirm if I am on right track.

Regards

Jaideep

• ###### 3. Re: Time Calculations

Hi Shin,

There can be any number of ACTIVE and NOT ACTIVE states between Start Date and End Date.

• ###### 4. Re: Time Calculations

Hi Jaideep,

In the above example. NOT ACTIVE will be (11:14:48 - 11:14:45) = 3 Sec

Rest everything will be under ACTIVE, that is the business logic being followed.

Thanks.