3 Replies Latest reply on Aug 26, 2016 6:22 AM by elizabeth.gancas

# DateTime, Parameters, KPI

Hi All-

I'm looking to use the 'Late?' KPI to mark when an Employee punches in after the time indicated by the parameters.

I'm currently using this calc (this is the closest I've come to solving my own problem)

if datepart('minute', [In Punch]) > [Punch In Minute Limit] then 'Late'

elseif datepart('hour', [In Punch]) > [Punch In Hour Limit] then 'Late'

else 'Early'

END

However, it is giving me 'late' results based on only the minute datepart.

Example: Employee 110877 punched in at 5:38 am which is well before 8:30 am but is being counted as late.

Thank you in advance for any help!

• ###### 1. Re: DateTime, Parameters, KPI

You could use this calc:

IF

DATEDIFF('minute'

,[In Punch]

,DATETIME(STR(DATE([In Punch]))+' '+STR([Punch In Hour Limit])+':'+STR([Punch In Minute Limit]))

) < 0 THEN 'Late'

ELSE 'Early'

END

• ###### 2. Re: DateTime, Parameters, KPI

Perfect! Thank you!!

• ###### 3. Re: DateTime, Parameters, KPI

I tried using the same calculation to see who punched out late but all of my results are showing as Late - even for employees who punched out before the specified time

Out Punch is a date time dimension

Punch Out Hour Limit/Minute Limit are integer parameters

Please let me know if you have any ideas as to what I'm doing wrong.

Thank you!

IF

DATEDIFF('minute'

,[Out Punch]

,DATETIME(STR(DATE([Out Punch]))+' '+STR([Punch Out Hour Limit])+':'+STR([Punch Out Minute Limit]))

) < 0 THEN 'Late'

ELSE 'Early'

END