Skip to main content

Hello Folks,

 

I'm attempting to come up with a calculation that counts # of safe days FROM the last non-safe day.

 

So in the example below, our last safety incident was on 11/11/2018.  So I need to count the number of 1's from the most recent safety incident up until the current date (TODAY)

 

I'm assuming this is a FIXED LOD, but maybe not...

 

COUNT({FIXED [Date]:MAX(IF [Safe Day]=0 THEN... start counting up until today.

 

Any guidance would be much appreciated.  Thanks!

 

COUNTING # of Days Since Safety Incident

3 answers
  1. Dec 3, 2018, 3:12 PM

    Start with an LOD to give you the last non-safe day:

     

    Last Non-Safe Day

    {FIXED : MAX(IIF([Safe Day]=0, [Date], NULL))}

     

    Then an LOD to give you the latest date in the data set

     

    Last Day

    {FIXED : MAX([Date])}

     

    Then a calc to find the difference.

     

    Safe Days

    DATEDIFF('day', [Last Non-Safe Day], [Last Day])

     

    See attached sample workbook.

0/9000