sql - SSRS Average Time in Minutes and then Format to HH MM -


i've seen lot of questions average time in ssrs i'm pretty new , none of these questions address specific need appreciated.

i have duration field (fields!duration1.value) pulling in duration in minutes (example: 170). in stored procedure i'm converting hh mm so:

convert(varchar(5),dateadd(minute, test.duration,0) ,114) duration1 

this working charm , i'm using in ssrs report. unfortunately, have need of getting average duration. threw in original field test.duration select in stored procedure. report set matrix , "total" line want have average displayed.

so i'm pretty sure need first:

=avg(fields!test.duration.value) 

which works (but has ridiculous decimal value), how format value hh:mm??? i'm sure in stored procedure i'm not positive on how there either basically: , welcome!

thanks

you add own formatting function report code section:

public function minstohhmm (byval minutes decimal)   dim hourstring = floor(minutes/60).tostring()    dim minstring = floor(minutes mod 60).tostring()   return hourstring.padleft(2, "0") & ":" & minstring.padleft(2, "0") end function  

and call in cell expression this:

=code.minstohhmm(avg(fields!test.duration.value)) 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -