Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Count consecutive minutes within same group? 1

Status
Not open for further replies.

LvDRvr

Technical User
Jun 9, 2011
6
US
I am trying to find a formula that will help me count total minutes per instance.
Reset should be when date changes or when difference of minutes is more than 1 minute. I have even converted Time field (HH:MM)to total minutes.
Date Time (TotalMin)
01/27/2011 7:56 2 420 56 476
01/27/2011 7:57 420 57 477
01/27/2011 8:05 3 480 5 485
01/27/2011 8:06
01/27/2011 8:07
01/28/2011 9:01 1
01/28/2011 12:05 4
01/28/2011 12:06
01/28/2011 12:07
01/28/2011 12:08

The group field is on Datetime field and is set to per minute.

Any help is greatly appriciated.
Thanks.

 
If you were okay with having the result on the last field in the set instead of the first, you could just insert a running total that counts every row and resets based on a formula:

date({table.datetime}) <> date(previous({table.datetime})) or
datediff("n",previous({table.datetime}),{table.datetime}) <> 1

Then format the running total to suppress using a formula like this:

date({table.datetime}) = date(next({table.datetime})) and
datediff("n", {table.datetime},next({table.datetime})) = 1

-LB
 
LB, It is counting but not Running count.
On my Running Count formula I have inserted my
DateTime to do the count summary
Evaluate for each record
Reset at the above formula you provided.


I am getting the following results. I have tried many different ways to check this out.


Date Time (TotalMin)
01/27/2011 7:55 1
01/27/2011 7:56 2
01/27/2011 7:57 2
01/27/2011 8:05 1
01/27/2011 8:06 2
01/27/2011 8:07 2
01/28/2011 9:01 1
01/28/2011 12:05 1
01/28/2011 12:06 2
01/28/2011 12:07 2
01/28/2011 12:08 2

Any pointers?
 
What happens if you display the seconds in the datetime? I'm wondering if the minutes are getting rounded. So that, for example, 01/27/2011 8:07 2
is really: 01/27/2011 8:06:49 2

When using datediff for minutes, it is checking only the minute value, not the rounded value. Not sure what you would want to happen if the next value was actually the same minute--or do you want to round?

-LB

 
LB,
I formatted my DateTime Field to look like HH:MM.
What I want is, to count the length of time each instance is. One instance is a series of consecutive minutes.

I do have 2 groups on DateTime field.
Group1 is on Date to look for each day(I separate date from field)
Group2 is Time to look for each minute(I separate Time from Field)

So When i do Running count on Time field it should do the running count per minute change. But somehow its not doing it. Even if I use the Time converted to total minutes with one whole number and use it as a field to count, still does not do the running count.
Reset is working fine though.
 
I am asking you to format it the HH:mm:ss just so that you can see what is happening. Did you follow what I meant about rounding? Then report back.

-LB
 
Oh Thanks I got it now. Thank you so much. You have been great help. Have a great weekend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top