Friday, March 9, 2012

Reporting Services Formatting Fields from whole minutes to hours

Dear All,

I have a problem formatting a field in Reporting Services (minutes to hours).

I have a field called duration which stores time in whole minutes only. I can format this into hours within mssql using the following:

cast(sn.duration/60 as varchar(5)) + ':' + RIGHT('0' + cast(sn.duration%60 as varchar(2)), 2)

But I need to have totals and average columns in my report, which means that the data must come through to RS in the minutes format so I can perform the calculations there.

I have the first part (I think!!):

=string.format("{0:0}",Fields!SalesTime.Value / 60) + ":"

But I cannot get the minutes part working!

Any help would be gratefully received.

Dan

note direction of the slash!

635

= (635\60) & ":" & 635 - ((635 \ 60) * 60)|||

Thank you,

with a little formatting it has worked a treat!!!

Dan

No comments:

Post a Comment