Description
These examples show various ways of throughput time calculations in PQL.
Throughput time calculations are vital in powerful process mining applications. In the following, different kinds of throughput times and possible calculations using PQL are presented:
- Throughput Times per Case: Learn how to calculate throughput times inside a case, e.g. the time from the start of each case to the end of the case or between specified activities within a case.
- Throughput Times between Activities: Learn how to calculate the throughput times between consecutive activities inside a case.
- Throughput Times over multiple Cases: Learn how to calculate throughput times over multiple cases, e.g. the throughput times of orders consisting of multiple cases.
Throughput Times per Case
Throughput time calculations on case level can be solved using CALC_THROUGHPUT. It is usually used together with REMAP_TIMESTAMPS, which adds many options for calendar specifications.
Column1
"Cases"."Case"
Column2
CALC_THROUGHPUT ( CASE_START TO CASE_END , REMAP_TIMESTAMPS ( "Activities"."Timestamp" , DAYS ) )
Column1
"Cases"."Case"
Column2
CALC_THROUGHPUT ( LAST_OCCURRENCE [ 'A' ] TO FIRST_OCCURRENCE [ 'C' ] , REMAP_TIMESTAMPS ( "Activities"."Timestamp" , DAYS ) )
Column1
"Cases"."Case"
Column2
CALC_THROUGHPUT ( CASE_START TO CASE_END , REMAP_TIMESTAMPS ( "Activities"."Timestamp" , HOURS ) ) / 24
Column1
"Cases"."Case"
Column2
CALC_THROUGHPUT ( CASE_START TO CASE_END , REMAP_TIMESTAMPS ( "Activities"."Timestamp" , DAYS , WEEKDAY_CALENDAR ( MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY ) ) )
FIRST_OCCURRENCE
range specifier:
Column1
"Cases"."Case"
Column2
CALC_THROUGHPUT ( CASE_START TO FIRST_OCCURRENCE [ 'ErrorActivity' ] , REMAP_TIMESTAMPS ( "Activities"."Timestamp" , DAYS ) , CASE WHEN "Activities"."Activity" LIKE 'Error%' THEN 'ErrorActivity' ELSE "Activities"."Activity" END )
Throughput Times between Activities
Throughput times between consecutive activities can be calculated using SOURCE and TARGET, usually combined with a DateTime Difference function or REMAP_TIMESTAMPS. The Process Explorer and the Variant Explorer use this approach to calculate the throughput time for each edge in the graph.
Column1
"Cases"."Case"
Column2
SOURCE ( "Activities"."Activity" )
Column3
TARGET ( "Activities"."Activity" )
Column4
DAYS_BETWEEN ( SOURCE ( "Activities"."Timestamp" ) , TARGET ( "Activities"."Timestamp" ) )
Column1
"Cases"."Case"
Column2
SOURCE ( "Activities"."Activity" )
Column3
TARGET ( "Activities"."Activity" )
Column4
REMAP_TIMESTAMPS ( TARGET ( "Activities"."Timestamp" ) , DAYS , WEEKDAY_CALENDAR ( MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY ) ) - REMAP_TIMESTAMPS ( SOURCE ( "Activities"."Timestamp" ) , DAYS , WEEKDAY_CALENDAR ( MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY ) )
Connection to the Process Explorer
The SOURCE and TARGET functions are used in the Process Explorer and Variant Explorer to calculate the edge KPIs, as shown in the following examples:
SECONDS
and then converted to
DAYS
by dividing the difference by 60*60*24
. Finally, the result is rounded. The
corresponding Process Explorer would look like this:
Column1
SOURCE ( "Activities"."Activity" )
Column2
TARGET ( "Activities"."Activity" )
Column3
ROUND ( AVG ( ( REMAP_TIMESTAMPS ( TARGET ( "Activities"."Timestamp" ) , SECONDS ) - REMAP_TIMESTAMPS ( SOURCE ( "Activities"."Timestamp" ) , SECONDS ) ) / ( 60 * 60 * 24 ) ) )
Column1
SOURCE ( "Activities"."Activity" , REMAP_VALUES ( "Activities"."Activity" , [ 'B' , null ] ) )
Column2
TARGET ( "Activities"."Activity" )
Column3
ROUND ( AVG ( ( REMAP_TIMESTAMPS ( TARGET ( "Activities"."Timestamp" ) , SECONDS ) - REMAP_TIMESTAMPS ( SOURCE ( "Activities"."Timestamp" ) , SECONDS ) ) / ( 60 * 60 * 24 ) ) )
Throughput Times over multiple Cases
Throughput times over multiple cases can be calculated using PU_MIN and PU_MAX, combined with a DateTime Difference function or REMAP_TIMESTAMPS. This can be used to calculate the time range covered by all cases that are grouped together based on a certain property.
Column1
"Orders"."ID"
Column2
DAYS_BETWEEN ( PU_MIN ( "Orders" , "Activities"."Timestamp" ) , PU_MAX ( "Orders" , "Activities"."Timestamp" ) )
Column1
AVG ( REMAP_TIMESTAMPS ( PU_MAX ( "Orders" , "Activities"."Timestamp" ) , DAYS ) - REMAP_TIMESTAMPS ( PU_MIN ( "Orders" , "Activities"."Timestamp" ) , DAYS ) )