sql server - Display Sum of time in HH:MM format in SSRS 2008 -


i have table last column total_service_time in hh:mm format getting correctly sql query.

i getting #error while adding expression =sum(fields!total_service_time.value) in last row sum of total_service_time in hh:mm format.

is there way sum of time in hh:mm format in last row

my query total_service_time value:

(select    cast(total / 60 varchar(8)) + ':' + cast(total % 60 varchar(2)) expr1  (select cast(sum(action.[travel time] + action.[total productive time]) int) total) t) total_service_time 

screenshot thanks, salman

your trying sum hours , minutes format not compatible sum add hours , minutes need use specific datetime functions. try out below expression -

=right("0" & sum(cint(left(fields!total_service_time.value,2)), "<datasetname>")     + floor(sum(cint(right(fields!total_service_time.value,2)), "<datasetname>") / 60),2)   & ":" & sum(cint(right(fields!total_service_time.value,2)), "<datasetname>") mod 60 

what trying taking total hours, adding overflow total minutes, concatenating minutes. references - sample dataset output

edit: new expression per requirement -

=sum(hour(fields!total_service_time.value)) + floor(sum(minute(fields!total_service_time.value))/60) & ":" & sum(minute(fields!total_service_time.value)) mod 60 

screenshots based on edited query - dataset replicated result -  output

edit: try expression -

=sum(cint(mid(fields!total_service_time.value,1,instr(fields!total_service_time.value,":")-1)), "<datasetname>")     + floor(sum(cint(right(fields!total_service_time.value,2)), "<datasetname>") / 60)     & ":" & sum(cint(right(fields!total_service_time.value,2)), "<datasetname>") mod 60 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -