process-mining
latest
false
UiPath logo, featuring letters U and I in white

Process Mining

Automation CloudAutomation Cloud Public SectorAutomation SuiteStandalone
Last updated Feb 28, 2025

Configuring Due dates

If you want to use the Due dates dashboard to analyze due dates, due dates must be defined for your app template.

If there are out of the box due dates available for your app template, these due dates will be shown in the Due dates dashboard. In the documentation for your specific app template you will find an overview of the available due dates. The App Templates page contains links to the documentation for all available app templates.

If no data is available in the due dates dashboard, you need to configure your own due dates in the models\5_business_logic\Due_dates_base.sql file using data transformations. Here you can also configure any default due dates to your business needs.
For Custom process you can also upload due dates using the Due_dates_raw.csv file. Check out Custom process input fields.

Adding business logic in transformations

In the last transformation step, business logic is added as needed for data analysis.

Each record in the due dates table represents one due date for a certain object. Example due dates are:

  • a payment deadline for a payment object.
  • an approval deadline for purchase requisition.
The mandatory fields for this table are the Case_ID, Due_date, Actual_date, and Expected_date.


Not all events will have a due date and some events may have multiple due dates.

Refer to Data transformations editor for more information.

Providing due date configuration input in Data transformations

You can provide additional input data to be used for the calculations in the Due dates dashboard using SQL statements in Data transformations. For all due dates, you can configure the following fields.

Name

Type

Description

Due_dateText

The name of the due date.

Due_date_typeText

The Due date type.

Fixed_costs

Boolean

An indication whether costs are fixed or time based.

Cost

Float

Fixed costs: The amount of costs.
Variable costs: The amount of costs per Time and Type_type.

Time

Integer

A number indicating the amount of time in case of time-based costs.

Time_typeTextType of time period for cost calculations. This can be any of the following values: day, hour, minute, second, millisecond.

Case_ID

Text/Integer

The ID of the Case to which the due date is related.

Check out Transformations.

Providing due date configuration input using dbt seeds

For process apps that still contain the Due_dates_configuration_raw.csv seeds file in the seeds\ folder of the data transformations, you can use this file to provide additional input data to be used for the calculations in the Due dates dashboard.

The following illustration shows an example seeds file.
Example seeds file
Check out Transformations.

SQL examples for configuring Due dates

This page contains some SQL examples that you can use to configure Due dates using transformations.
Attention:
The SQL examples are based on Event log and Custom process app templates, and use Cases that have a Case_ID. If you want to use the SQL examples to define Due dates for Purchase-to-Pay app templates or Order-to-Cash app templates, make sure to use the appropriate object and the related internal object_ID. For Purchase-to-Pay you can use the Purchase_order_item_end_to_end_events event log, the Purchase_order_items object and the Purchase_order_item_ID_internal as Case_ID. For Order-to-Cash you can use the Sales_order_item_end_to_end_events event log, the Sales_order_items object and the Sales_order_item_ID_internal as Case_ID.

The following code block shows an example SQL query to define a due date.

select
    tableA."Case_ID",
    {{ pm_utils.as_varchar('Name of Due date') }} as "Due_date",
    tableB."SLA_date" as "Expected_date",
     tableA."Executed_date" as "Actual_date"
from {{ ref('tableA') }} as tableA
left join {{ ref('tableB') }} as tableB
on tableA."Case_ID" = tableB."Case_ID"select
    tableA."Case_ID",
    {{ pm_utils.as_varchar('Name of Due date') }} as "Due_date",
    tableB."SLA_date" as "Expected_date",
     tableA."Executed_date" as "Actual_date"
from {{ ref('tableA') }} as tableA
left join {{ ref('tableB') }} as tableB
on tableA."Case_ID" = tableB."Case_ID"

The following code block shows an example SQL query to configure due dates.

select
        Due_dates_base."Case_ID",
        Due_dates_base."Due_date",
        Due_dates_base."Actual_date",
        Due_dates_base."Expected_date",
        {{ pm_utils.as_varchar('Type of Due date') }} as "Due_date_type",
        case
            when Due_dates_base."Actual_date" <= Due_dates_base."Expected_date"
                then {{ pm_utils.to_boolean('true') }}
            else {{ pm_utils.to_boolean('false') }}
        end as "On_time",
        case
            -- when actual or expected date are null
            when Due_dates_base."Actual_date" is null or Due_dates_base."Expected_date" is null
                then {{ pm_utils.to_double('null') }}
            -- when the due date is on time, the cost is 0
            when Due_dates_base."Actual_date" <= Due_dates_base."Expected_date"
                then {{ pm_utils.to_double('0') }}
            -- when the due date is late, configure a cost
            when Due_dates_base."Expected_date" > Due_dates_base."Actual_date"
                then {{ pm_utils.to_double('10') }}
        end as "Cost",
        {{ pm_utils.datediff('millisecond', 'Due_dates_base."Expected_date"', 'Due_dates_base."Actual_date"') }} as "Difference"
    from Due_dates_baseselect
        Due_dates_base."Case_ID",
        Due_dates_base."Due_date",
        Due_dates_base."Actual_date",
        Due_dates_base."Expected_date",
        {{ pm_utils.as_varchar('Type of Due date') }} as "Due_date_type",
        case
            when Due_dates_base."Actual_date" <= Due_dates_base."Expected_date"
                then {{ pm_utils.to_boolean('true') }}
            else {{ pm_utils.to_boolean('false') }}
        end as "On_time",
        case
            -- when actual or expected date are null
            when Due_dates_base."Actual_date" is null or Due_dates_base."Expected_date" is null
                then {{ pm_utils.to_double('null') }}
            -- when the due date is on time, the cost is 0
            when Due_dates_base."Actual_date" <= Due_dates_base."Expected_date"
                then {{ pm_utils.to_double('0') }}
            -- when the due date is late, configure a cost
            when Due_dates_base."Expected_date" > Due_dates_base."Actual_date"
                then {{ pm_utils.to_double('10') }}
        end as "Cost",
        {{ pm_utils.datediff('millisecond', 'Due_dates_base."Expected_date"', 'Due_dates_base."Actual_date"') }} as "Difference"
    from Due_dates_base

Activity X done before date Y

This SQL code identifies cases where the last occurrence of activity 'X' was done before date 'Y'.

with Event_log_base as (
    select * from {{ ref('Event_log_base') }}
),

Cases_base as (
    select * from {{ ref('Cases_base') }}
),

-- Last activity X of each case
Last_activity_X as (
    select
        Event_log_base."Case_ID",
        max(Event_log_base."Event_end") as "Event_end",
        max(Event_log_base."Event_ID") as "Event_ID"
    from Event_log_base
    where Event_log_base."Activity" = 'X'
    group by Event_log_base."Case_ID"
),

-- Last activity X should be done before Case date field Y
Activity_X_done_before_date_Y as (
    select
        Last_activity_X."Case_ID",
        {{ pm_utils.as_varchar('Last activity X before Cases date field Y') }} as "Due_date",
        Last_activity_X."Event_end" as "Actual_date",
        Cases_base."Case_date_field_Y" as "Expected_date",
        Last_activity_X."Event_ID"
    from Last_activity_X
    inner join Cases_base
        on Last_activity_X."Case_ID" = Cases_base."Case_ID"
)

select * from Activity_X_done_before_date_Ywith Event_log_base as (
    select * from {{ ref('Event_log_base') }}
),

Cases_base as (
    select * from {{ ref('Cases_base') }}
),

-- Last activity X of each case
Last_activity_X as (
    select
        Event_log_base."Case_ID",
        max(Event_log_base."Event_end") as "Event_end",
        max(Event_log_base."Event_ID") as "Event_ID"
    from Event_log_base
    where Event_log_base."Activity" = 'X'
    group by Event_log_base."Case_ID"
),

-- Last activity X should be done before Case date field Y
Activity_X_done_before_date_Y as (
    select
        Last_activity_X."Case_ID",
        {{ pm_utils.as_varchar('Last activity X before Cases date field Y') }} as "Due_date",
        Last_activity_X."Event_end" as "Actual_date",
        Cases_base."Case_date_field_Y" as "Expected_date",
        Last_activity_X."Event_ID"
    from Last_activity_X
    inner join Cases_base
        on Last_activity_X."Case_ID" = Cases_base."Case_ID"
)

select * from Activity_X_done_before_date_Y

Activity X done within 5 days after activity Y

This SQL code identifies cases for which the last occurence of activity 'X' happened within 5 days after the last occurence of activity 'Y'.

with Event_log_base as (
    select * from {{ ref('Event_log_base') }}
),

-- Last activity X of each case
Last_activity_X as (
    select
        Event_log_base."Case_ID",
        max(Event_log_base."Event_end") as "Event_end",
        max(Event_log_base."Event_ID") as "Event_ID"
    from Event_log_base
    where Event_log_base."Activity" = 'X'
    group by Event_log_base."Case_ID"
),

-- Last activity Y of each case
Last_activity_Y as (
    select
        Event_log_base."Case_ID",
        max(Event_log_base."Event_end") as "Event_end",
        max(Event_log_base."Event_ID") as "Event_ID"
    from Event_log_base
    where Event_log_base."Activity" = 'Y'
    group by Event_log_base."Case_ID"
),

-- Last activity X should be done at date of last Event Y + 5 days
Activity_X_done_within_5_days_after_activity_Y as (
    select
        Last_activity_Y."Case_ID",
        {{ pm_utils.as_varchar('Last activity X before last activity Y + 5 days') }} as "Due_date",
        {{ pm_utils.dateadd('day', 5, 'Last_activity_Y."Event_end"') }} as "Expected_date",
        Last_activity_X."Event_end" as "Actual_date",
        Last_activity_Y."Event_ID" as "Event_ID"
    from Last_activity_Y
    inner join Last_activity_X
        on Last_activity_Y."Case_ID" = Last_activity_X."Case_ID"
)

select * from Activity_X_done_within_5_days_after_activity_Ywith Event_log_base as (
    select * from {{ ref('Event_log_base') }}
),

-- Last activity X of each case
Last_activity_X as (
    select
        Event_log_base."Case_ID",
        max(Event_log_base."Event_end") as "Event_end",
        max(Event_log_base."Event_ID") as "Event_ID"
    from Event_log_base
    where Event_log_base."Activity" = 'X'
    group by Event_log_base."Case_ID"
),

-- Last activity Y of each case
Last_activity_Y as (
    select
        Event_log_base."Case_ID",
        max(Event_log_base."Event_end") as "Event_end",
        max(Event_log_base."Event_ID") as "Event_ID"
    from Event_log_base
    where Event_log_base."Activity" = 'Y'
    group by Event_log_base."Case_ID"
),

-- Last activity X should be done at date of last Event Y + 5 days
Activity_X_done_within_5_days_after_activity_Y as (
    select
        Last_activity_Y."Case_ID",
        {{ pm_utils.as_varchar('Last activity X before last activity Y + 5 days') }} as "Due_date",
        {{ pm_utils.dateadd('day', 5, 'Last_activity_Y."Event_end"') }} as "Expected_date",
        Last_activity_X."Event_end" as "Actual_date",
        Last_activity_Y."Event_ID" as "Event_ID"
    from Last_activity_Y
    inner join Last_activity_X
        on Last_activity_Y."Case_ID" = Last_activity_X."Case_ID"
)

select * from Activity_X_done_within_5_days_after_activity_Y

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2025 UiPath. All rights reserved.