Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

date difference average question Expand / Collapse
Author
Message
Posted Tuesday, August 19, 2014 3:35 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: 2 days ago @ 7:47 AM
Points: 130, Visits: 470
Hi

I have a begindate and enddate in my report. When I have an expression enddate-begindate in a timedifference column, it shows perfectly as 00:11:16 in the format hh:mm:ss.

Now I need to add an average column. And I am not able to convert 00:11:16 to string or any other datatype so I could use split expression to get the individual parts and calculate total number of average seconds. If I am able to get average seconds, I can convert to hh:mm:ss format bu using a format function.

Could anyone please help me on this one. Is there a way to find the average time difference? I hugely appreciate a quick response. I have been stuck with this for hours. I don't want to change my data query, as it is very complex.

Thank you,
Veena
Post #1605210
Posted Wednesday, August 20, 2014 7:34 AM This worked for the OP Answer marked as solution
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: 2 days ago @ 7:47 AM
Points: 130, Visits: 470
Hers is the expression I used to get the average which works:

Format(DateAdd("s",avg(DateDiff(DateInterval.Second,Fields!BeginDate.Value,Fields!EndDate.Value)), "00:00:00"),"HH:mm:ss")

Thank you All
Post #1605426
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse