Totalling HHMMSS in SSRS

From the image above, I am totalling the column HHMMSS is SSRS with the below expression:

=CStr(sum(CInt(split(Fields!HHMMSS.Value,":")(0)))+sum(CInt(split(Fields!HHMMSS.Value,":")(1)))\60)
  &":"& CStr(sum(CInt(split(Fields!HHMMSS.Value,":")(1))) mod 60+sum(CInt(split(Fields!HHMMSS.Value,":")(2)))\60)  
  &":"& CStr(sum(CInt(split(Fields!HHMMSS.Value,":")(2))) mod 60)


I equally tried:

=iif(Fields!HHMMSS.Value = "", "", CStr(sum(CInt(split(Fields!HHMMSS.Value,":")(0)))
 +sum(CInt(split(Fields!HHMMSS.Value,":")(1)))\60)
   &":"& CStr(sum(CInt(split(Fields!HHMMSS.Value,":")(1)))
  mod 60+sum(CInt(split(Fields!HHMMSS.Value,":")(2)))\60) 
  &":"& CStr(sum(CInt(split(Fields!HHMMSS.Value,":")(2))) mod 60))and nothing works. What could be wrong with my expression?

Thank you

September 9th, 2015 8:00am

Hi Yookos,

Try This as a workaround to sum time .

=Date.FromOADate(Sum(Fields!YourTimeColumn.Value.ToOADate())).ToString("hh:mm:ss")

OR

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

OR

=Right("0" & Sum(CInt(Left(Fields!YourTimeColumn.Value,2)), "DataSet1")
    + Floor(Sum(CInt(Right(Fields!YourTimeColumn.Value,2)), "DataSet1") / 60),2)
  & ":" & Sum(CInt(Right(Fields!YourTimeColumn.Value,2)), "DataSet1") Mod 6
Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 8:20am

Hi Yookos,

Based on your sample data, we have created a dataset which contains the time data type field [HHMMSS], then we create a tablix in a report to total values for this field.

Based on out test, the second expression: =TimeSpan.FromTicks(Sum(Fields!YourTimeColumn.Value)) suggested by Milan can return correct total value for [HHMMSS] field.

Also you can use the expression like below:

=IIF(len(cstr(sum(Fields!HHMMSS.Value)\10000000\60\ 60))=1,"0" & cstr(sum(Fields!HHMMSS.Value)\10000000\60\ 60),cstr(sum(Fields!HHMMSS.Value)\10000000\60\ 60)) & ":" & cstr(sum(Fields!HHMMSS.Value)\10000000\60 mod 60) & ":" & cstr(sum(Fields!HHMMSS.Value)\10000000 mod 60)

Please refer to screenshots below:

If you have any question, please feel free to ask.

Best regards,
Qiuyun Yu

September 9th, 2015 11:27pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics