1

I want to add two columns(Time Field-HH:MM:SS) in the SSRS table report.

E.g.:

Login_Time     Logout_Time    Total_Time
2:13:10        6:10:05        8:23:15  
3:31:09        6:01:01        9:32:10

I have inserted new column in the report to get a total time which should calculate from other two fields from the report. I have tried Format,Timespan, Floor(Sum) but it's throwing an error.

Arun
  • 21
  • 3

2 Answers2

1

You can't perform Sum() on timespans, but you can do addition and subtraction, what you need to do is subtract the Logout Time from Login Time:

=Fields!Logout_Time.Value - Fields!Login_Time.Value

This will give you a timespan field with the duration between the log in and log out times.

Dan Scally
  • 1,922
  • 1
  • 19
  • 31
1

If your fields are string data type you can try using:

=Format(CDate(Fields!Login_Time.Value).
  AddHours(CDate(Fields!Logout_Time.Value).Hour).
  AddMinutes(CDate(Fields!Logout_Time.Value).Minute).
  AddSeconds(CDate(Fields!Logout_Time.Value).Second),"HH:mm:ss")

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
alejandro zuleta
  • 13,962
  • 3
  • 28
  • 48
  • This is perfect and solved the issue, the SUM is working perfectly.. Thank you so much Alejandro. – Arun Mar 03 '17 at 06:39
  • @Arun, you are welcome. If my answer solved your issue you can [mark it as the correct answer](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) to positively close the question. – alejandro zuleta Mar 03 '17 at 12:38