Forum Discussion
Anonymous
6 years agoNot applicable
Count Days Since last OSHA Incident
Hello, I'm stumped. I need help creating a count of days between "Yes" recordable events, and count of days since our most recent "Yes" OSHA Recordable. Date of Incident Incident Type ...
- Anonymous6 years ago
Anonymous
In this case, I would suggest you to create a column instead of a measure. See my sample below, hope it makes sense for you.count since last yes = IF ( Sheet6[OSHA Recordable] = "Yes", DATEDIFF ( CALCULATE ( MAX ( [Date of Incident] ), FILTER ( Sheet6, [Date of Incident] < EARLIER ( Sheet6[Date of Incident] ) ), FILTER ( Sheet6, [OSHA Recordable] = "Yes" ) ), [Date of Incident], DAY ), BLANK () )Best,
Paul
Nathaniel_C
Community Champion
6 years agoHi Anonymous ,
Try this:
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Date Diff =
VAR _currDate =
MAX ( injTable[Date of Incident] )
VAR _pastDate =
CALCULATE (
MAX ( injTable[Date of Incident] ),
ALLEXCEPT ( injTable, injTable[OSHA Recordable] ),
injTable[Date of Incident] < _currDate
)
RETURN
IF (
MAX ( injTable[OSHA Recordable] ) = "YES",
DATEDIFF ( _pastDate, _currDate, DAY )
)