SSRS IIF & Switch Not behaving
Posted on 2015-01-22
I am working on a SSRS Report that looks at attendance. I am calculating how many minutes an employee is from clocking in verses the time he/she is supposed to be clocking in. Our rule is, if you are more than 5 minutes from when you are supposed to clock in, you are late. If you are more than 5 minutes before, you are early. Anything and everything in between is considered on time. Example: Employee has a start time of 9AM. they punch in at 9:06, that would be considered late. they clock in at 8:57, that is considered on time. They clock in at 8:54, that is considered early.
So, I am looking at this Time difference and attempting to make SSRS return the "early, late, on time" flag.
=iif(Fields!Time_Diff.Value > 5, "LATE","EARLY") This statement will give me all of the lates, and defaults everything else to early.
So, I then decided I need a SWITCH statement to look for the on time ones:
=Switch(Fields!Time_Diff.Value > 5, "Late",
Fields!Time_Diff.Value < -5, "Early",
When I do that, I get "#ERROR" returned for all values. Am I doing something wrong with the switch? That syntax looks correct to me.