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
Anonymous
6 years agoNot applicable
Hello Paul,
Thank you very much for this! When I plugged these in the "countdays between two yes" it only gives me the number of days between the last two OSHA recordables of the month. How could I expand this DAX to count every day between every yes? Again, thank you Anonymous !
| 2018 | Count of OSHA Recordable | Countdays between two Yes |
| March | 3 | 7 |
| 1 | 1 | |
| 22 | 1 | |
| 29 | 1 | |
| April | 2 | 11 |
| 12 | 1 | |
| 23 | 1 |
Anonymous
6 years agoNot applicable
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
- Anonymous6 years agoNot applicable
Awesome this is great, thank you so much!