Search code examples
sql.netreportingrdlcrdl

RDLC Report - How to calculate Total Hours from Time in Hours:Minutes


I am using RDLC Report. My requirement is, I need to calculate total Hours from values like 9:45 10:02

11:00

Main thing is it including blank values. So How I need to make equation for RDLC Report for getting total hours:minutes.

My current equation is as per below but it gives me #error :

=(TimeSpan.FromTicks(Sum(IIf((Fields!TimeDiff.Value) = " " , System.TimeSpan.Parse("00:00:00"), System.TimeSpan.Parse(Fields!TimeDiff.Value)))).Days * 24 + 
TimeSpan.FromTicks(Sum(IIf((Fields!TimeDiff.Value) = " ", System.TimeSpan.Parse("00:00:00"), System.TimeSpan.Parse(Fields!TimeDiff.Value)))).Hours).ToString +":" + 
TimeSpan.FromTicks(Sum(IIf((Fields!TimeDiff.Value) = " ", System.TimeSpan.Parse("00:00:00"), System.TimeSpan.Parse(Fields!TimeDiff.Value)))).Minutes.ToString("d2")

Thanks for your help.


Solution

  • You can use this:

    System.TimeSpan.FromTicks(sum(Fields!TimeDiff.Value))