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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Internet Usage based on rows

Status
Not open for further replies.

gillonia

MIS
Sep 17, 2002
50
GB
CR10

From a table containing the following two fields:

"URL", "DateTime"

I'm looking to calculate the total time spent on internet sites, data is in the following format:

<Row 1> 01/08/2008 12:40
<Row 2 > 01/08/2008 12:42
<Row 3 > 01/08/2008 12:43
<Row 4 > 01/08/2008 12:45
<Row 5 > 01/08/2008 12:48
<Row 6 > 01/08/2008 12:49
<Row 7 > 01/01/2008 15:23
<Row 8 > 01/01/2008 15:25
<Row 9 > 01/01/2008 15:31
<Row 10 > 01/01/2008 15:32
<Row 11 > 01/01/2008 15:34
<Row 12 > 01/01/2008 15:37

I would like a summary of:
9 mins
14 mins
IE grouped by URL and time compared to previous row.

Any suggestions on how to achieve this would be most appreciated, thanks in advance.
 
group by the site and then
have a formula to get the max-min of the time spent.

Have one summary with Maximum and the other with Minimum and then write a formula to subtract.

I hope this helps.
 
Thanks very much for the reply Raj, one issue I foresee with that is if the pattern repeated itself later in the day, ie in the example below, if I take the max & min of it'll give me 12:40-15:49, when I should really be looking at 12:40-12:49 & 15:40-15:49....

<Row 1> 01/08/2008 12:40
<Row 2 > 01/08/2008 12:42
<Row 3 > 01/08/2008 12:43
<Row 4 > 01/08/2008 12:45
<Row 5 > 01/08/2008 12:48
<Row 6 > 01/08/2008 12:49
<Row 7 > 01/01/2008 15:23
<Row 8 > 01/01/2008 15:25
<Row 9 > 01/01/2008 15:31
<Row 10 > 01/01/2008 15:32
<Row 11 > 01/01/2008 15:34
<Row 12 > 01/01/2008 15:37
<Row 13> 01/08/2008 15:40
<Row 14 > 01/08/2008 15:42
<Row 15 > 01/08/2008 15:43
<Row 16 > 01/08/2008 15:45
<Row 17 > 01/08/2008 15:48
<Row 18 > 01/08/2008 15:49

What do you think?
 
Just a idea not tested

Here is waht i might give it a try:
Group on the url

Have a formula to get the diff of the two consecutive rows.
Diff:
if firstrecord or table.url<>previous(table.url)
then diff=0 else
table.url-previous(table.url)

place this in the details section,then have a running total to add these up .

Will be back,didn't put it into exact tech terms ,just put a thought here.
Hope this gives an idea .

As you know running total reset after group.
 
Group on URL then create a Formula time spent:
whileprintingrecords;
numbervar timespent;

If PreviousIsNull ({table.url}) or {table.url}<>previous( {table.url}) Then timespent=0 else datediff("s",{table.url},previous({table.url})

What basically i'm trying to do is see if it's the first record or if it's the first record of the next batch of the same url and making the timespent 0.
else the differrence. This will give you the minutes.

Now you can have a summary on this formula at group level to get the total minutes .
Then you can change the minutes into HH:MM:SS by changing this formula a little bit.
FAQ767-3543: Displaying a time as HH:MM:SS or DD:HH:MM:SS


I still didn't tested it ,i will try to test it.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top