Forum Discussion
Calculate Duration Column From Status's
- 5 years ago
Hi, Anonymous
You can make some changes to the dax formulas.
Calculated column 1:
rank_table = RANKX(FILTER(ALL('Table'),'Table'[CaseId]=EARLIER('Table'[CaseId])),'Table'[CreatedDate],,ASC)
Calculated column 2:
Status Duration =
VAR res =
MINX (
FILTER (
ALL ( 'Table' ),
'Table'[rank_table]
= EARLIER ( 'Table'[rank_table] ) + 1&&'Table'[CaseId]=EARLIER('Table'[CaseId])
),
'Table'[CreatedDate]
) - 'Table'[CreatedDate]
RETURN
IF ( 'Table'[NewValue] = "Closed", BLANK (), FORMAT ( res, "hh:mm:ss" ) )
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thank you for reply! unfortunately this won't work fro me because there's many Cases that may have been done sequentially. ranking only by createdDate won't work. I need to find a way to filter by createdDate AND caseID, is there a way to do that?
Hi, Anonymous
You can make some changes to the dax formulas.
Calculated column 1:
rank_table = RANKX(FILTER(ALL('Table'),'Table'[CaseId]=EARLIER('Table'[CaseId])),'Table'[CreatedDate],,ASC)
Calculated column 2:
Status Duration =
VAR res =
MINX (
FILTER (
ALL ( 'Table' ),
'Table'[rank_table]
= EARLIER ( 'Table'[rank_table] ) + 1&&'Table'[CaseId]=EARLIER('Table'[CaseId])
),
'Table'[CreatedDate]
) - 'Table'[CreatedDate]
RETURN
IF ( 'Table'[NewValue] = "Closed", BLANK (), FORMAT ( res, "hh:mm:ss" ) )
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.