Forum Discussion
Krlos5411
1 year agoFrequent Visitor
Compare two dates in different lines for same ID
Hi All, I need to calculate the time between the CREATE status and the APPROVAL status for every ticket that has those stages. There's some tickets that has no APPROVAL status for example. So I ...
- 1 year ago
Hi Krlos5411
Would a measure like this work?
Days from Created to Approval = VAR _CurrStatus = SELECTEDVALUE('Table'[Status]) VAR _Create = CALCULATE( MIN('Table'[Due Date]), ALL('Table'[Due Date]), 'Table'[Status] = "CREATE" ) VAR _Approval = CALCULATE( MAX('Table'[Due Date]), ALL('Table'[Due Date]), 'Table'[Status] = "APPROVAL" ) VAR _Result = IF( NOT ISBLANK(_Approval) && _CurrStatus = "APPROVAL", DATEDIFF(_Create, _Approval, DAY) ) RETURN _ResultLet me know if you have any questions.
Days from Created to Approval.pbix
gmsamborn
Super User
1 year agoHi Krlos5411
Would a measure like this work?
Days from Created to Approval =
VAR _CurrStatus = SELECTEDVALUE('Table'[Status])
VAR _Create =
CALCULATE(
MIN('Table'[Due Date]),
ALL('Table'[Due Date]),
'Table'[Status] = "CREATE"
)
VAR _Approval =
CALCULATE(
MAX('Table'[Due Date]),
ALL('Table'[Due Date]),
'Table'[Status] = "APPROVAL"
)
VAR _Result =
IF(
NOT ISBLANK(_Approval)
&& _CurrStatus = "APPROVAL",
DATEDIFF(_Create, _Approval, DAY)
)
RETURN
_Result
Let me know if you have any questions.
Days from Created to Approval.pbix