Forum Discussion
madbaird
2 years agoFrequent Visitor
Getting time between two dates in same column based on event criteria
I am trying to figure out how to get the difference between two dates based on the event. I have event IDs as follows: 1=Created 2=Activated 3=Respond 4=Resolve 5=Closed I need to get the days...
- Anonymous2 years ago
HI madbaird,
You can try to use the following measure formasi lot get the difference between two event names if helps:
formula = VAR created = CALCULATE ( MIN ( 'Table'[date_hour_local] ), FILTER ( ALLSELECTED ( 'Table' ), [Event_Name] = "Created" ), VALUES ( 'Table'[item_id] ) ) VAR resolved = CALCULATE ( MAX ( 'Table'[date_hour_local] ), FILTER ( ALLSELECTED ( 'Table' ), [Event_Name] = "Resolved" ), VALUES ( 'Table'[item_id] ) ) VAR lastest = CALCULATE ( MAX ( 'Table'[date_hour_local] ), ALLSELECTED ( 'Table' ), VALUES ( 'Table'[item_id] ) ) VAR eventList = CALCULATETABLE ( VALUES ( 'Table'[Event_Name] ), ALLSELECTED ( 'Table' ), VALUES ( 'Table'[item_id] ) ) RETURN IF ( "Resolved" IN eventList, DATEDIFF ( created, resolved, DAY ), DATEDIFF ( created, lastest, DAY ) )Regards,
Xiaoxin Sheng
Anonymous
2 years agoNot applicable
HI madbaird,
You can try to use the following measure formasi lot get the difference between two event names if helps:
formula =
VAR created =
CALCULATE (
MIN ( 'Table'[date_hour_local] ),
FILTER ( ALLSELECTED ( 'Table' ), [Event_Name] = "Created" ),
VALUES ( 'Table'[item_id] )
)
VAR resolved =
CALCULATE (
MAX ( 'Table'[date_hour_local] ),
FILTER ( ALLSELECTED ( 'Table' ), [Event_Name] = "Resolved" ),
VALUES ( 'Table'[item_id] )
)
VAR lastest =
CALCULATE (
MAX ( 'Table'[date_hour_local] ),
ALLSELECTED ( 'Table' ),
VALUES ( 'Table'[item_id] )
)
VAR eventList =
CALCULATETABLE (
VALUES ( 'Table'[Event_Name] ),
ALLSELECTED ( 'Table' ),
VALUES ( 'Table'[item_id] )
)
RETURN
IF (
"Resolved" IN eventList,
DATEDIFF ( created, resolved, DAY ),
DATEDIFF ( created, lastest, DAY )
)
Regards,
Xiaoxin Sheng
madbaird
2 years agoFrequent Visitor
Thank you, that seems to work as needed.