I am trying to perform a Sum() of time worked during the week and, seperately, during the weekend. The formula I am using for the weekday Sum() is:
=Sum(IIf((CInt(DatePart(DateInterval.WeekDay, Fields!Date.Value)) + FirstDayOfWeek.System) Mod 7 > 1, Fields!Time.Value, 0))
This results in #Error being displayed in the cell of the matrix. The issue seems to relate to the value of Fields!Date.Value because if I update the formula to:
=Sum(IIf((CInt(DatePart(DateInterval.WeekDay, Now())) + FirstDayOfWeek.System) Mod 7 > 1, Fields!Time.Value, 0))
Although this now assumes all activities were performed today, the result is a valid Sum() of the time spent. However I'm not sure what is wrong with the date data since extracting the "(CInt ... Mod 7" section of the expression into a new cell within the group it evaluates correctly for each column.
Can anyone advise what might be going wrong? The relevant subset of the dataset for this query is:
2016-04-25 00:00:00.000 7.5 2016-04-25 00:00:00.000 3.5 2016-04-25 00:00:00.000 0.5 2016-04-25 00:00:00.000 1 2016-04-25 00:00:00.000 7.5 2016-04-26 00:00:00.000 6.5 2016-04-26 00:00:00.000 6.5 2016-04-26 00:00:00.000 1 2016-04-26 00:00:00.000 7.5 2016-04-27 00:00:00.000 7.5 2016-04-27 00:00:00.000 4.5 2016-04-27 00:00:00.000 7.5 2016-04-27 00:00:00.000 1 2016-04-27 00:00:00.000 8 2016-04-28 00:00:00.000 6 2016-04-29 00:00:00.000 0 2016-04-30 00:00:00.000 0 2016-05-01 00:00:00.000 0
Update: Note that this issue occurs in the group's total column (where it's summing multiple days based on the condition I've included). Not sure if that was clear above.
Thanks.