Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


date difference average question


date difference average question

Author
Message
venus.pvr
venus.pvr
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 558
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
venus.pvr
venus.pvr
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 558
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search