Forum Discussion
Time between sequences
- 6 years ago
Hi, GunnerJ
Based on your description, i create data to reproduce your scenario. You can create a calculated column in data table as follows:
TASK TIME =
VAR seq = Workflow[BI_WRKFLW_TASK_SEQ_NBR]
VAR minDT =
CALCULATE (
Max ( Workflow[BI_EVENT_DT_TM] ),
FILTER (
Workflow ,
Workflow[BI_WRKFLW_TASK_SEQ_NBR]
= CALCULATE (
MAX ( Workflow[BI_WRKFLW_TASK_SEQ_NBR] ),
FILTER ( Workflow , Workflow[BI_WRKFLW_TASK_SEQ_NBR] < seq && Workflow[BI_SO_NBR] = EARLIER ( Workflow[BI_SO_NBR] )
&& Workflow[BI_TASK_CD] = EARLIER ( Workflow[BI_TASK_CD] )
&& Workflow[BI_WORK_EVENT_CD] = "COMP")
)
)
)
return
CALCULATE (
DATEDIFF (
minDT,
MAX ( Workflow[BI_EVENT_DT_TM] ),
SECOND
),
FILTER (
ALL ( Workflow ),
Workflow[BI_WRKFLW_TASK_SEQ_NBR] = EARLIER ( Workflow[BI_WRKFLW_TASK_SEQ_NBR] )
&& Workflow[BI_SO_NBR] = EARLIER ( Workflow[BI_SO_NBR] )
&& Workflow[BI_TASK_CD] = EARLIER ( Workflow[BI_TASK_CD] )
&& Workflow[BI_WORK_EVENT_CD] = "COMP"
)
)
Result:
If I misunderstand the your thoughts, please show us the sample data and expected output. I am glad to solve the problem for you.
Best Regards,
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, GunnerJ
If you take the answer of someone, please mark it as the solution to help the other members find it more quickly. If not, let me know and I'll try to help you further.
Thanks.
Best Regards,
Allan