May 30, 2012 at 10:04 am
hi friends ,
I am trying to get Average between 2 dates.
my expression in ssrs is :
=Avg(DateDiff("day",Fields!pend_start_time.Value,Fields!Pend_end_time.Value))
which is throwing error.Can anyone tell how to calculate average??
thanks.
May 30, 2012 at 10:31 am
what is the error. I think that to get days in SSRS you should use "d" instead of "day".
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 30, 2012 at 10:39 am
it is just showing #error while in preview mode.
My satrt and end date is datetime.Is that because of datetime???If so, how to calculate average days between 2 datetime values???
May 30, 2012 at 12:04 pm
As Sean points out, I think you just need to change "day" to "d"
I don't understand how you are doing your Average. DateDiff only returns a single number, and an average of a single number is just that number
Is your calculation happening in a total/summary row? If yes then this will not work because your dates and date diffs are not sums, and you can't really do them in this way.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply