Free2Rhyme2k
Free2Rhyme2k

Reputation: 554

SSRS total for time

I have a table as such:

----------------------------------------------
Name    |     Activity     |    Activity Time
----------------------------------------------
        |                  |
        |   L030           |    07:15:00
Dan     |                  |
Smith   |------------------------------------
        |                  |
        |   L031           |    01:00:00
        |                  |
        |------------------------------------
        |   Total          |
        |                  |
---------------------------------------------
        |                  |
        |   L030           |    01:15:00
Steve   |                  |
Jones   |------------------------------------
        |                  |
        |   L031           |    06:00:00
        |                  |
        |------------------------------------
        |   Total          |
        |                  |
---------------------------------------------

The name acts as a parent group for the activities and their associated times.

I thought that it would be a simple case of using the "add total" function to generate a total amount of time, however the option is greyed out.

Is it possible to use the "add total" function with times? If not, is there a workaround which would do the same job?

Thanks

Upvotes: 1

Views: 5552

Answers (3)

Free2Rhyme2k
Free2Rhyme2k

Reputation: 554

Thanks Wojciech Iłowiecki for putting me on the right lines.

I returned the times I wanted to present as minutes (as an integer) and used the following expression to display the correct formatted values in the box next to the individual activity:

 =FLOOR(Fields!Total_Time.Value / 60) & ":" & RIGHT("0" & (Fields!Total_Time.Value MOD 60), 2)

Of course as I used integers above, I could then use the "add total" function and formatted it using:

=FLOOR(Sum(Fields!Total_Time.Value) / 60) & ":" & RIGHT("0" & (Sum(Fields!Total_Time.Value) MOD 60), 2)

Resolved.

Upvotes: 1

UpwardD
UpwardD

Reputation: 767

=TimeSpan.FromTicks(Sum(Fields!DurationInMinutes.Value))

This should give the desired result.

Upvotes: 1

Wojciech Iłowiecki
Wojciech Iłowiecki

Reputation: 267

I think it's not possbile to perform SUM on dates.

But here the workarund:

return the 'activity time' values as a integer number of minutes:

then you can format this value in RS as a time, and also perform Sum for Total:

here the example for formatting from Minutes as Integer to time format:

= (Fields!DurationInMinutes.Value/60) + ":" + (Fields!DurationInMinutes.Value - ((Fields!DurationInMinutes.Value/60) *60) +  ":00"

Upvotes: 1

Related Questions