Overview
The Duration Between an Attribute and an Activity enrichment calculates the time difference between a timestamp stored in a case attribute and the occurrence of a selected activity. This enrichment is useful when you need to compare actual activity timing against expected dates, deadlines, or other reference timestamps stored at the case level.
Unlike the Duration Between Two Activities enrichment which measures time between activity occurrences, this enrichment allows you to measure against any timestamp attribute in your case data, making it ideal for SLA monitoring, deadline tracking, and variance analysis.
Common Uses
- Calculate duration between Due Date and actual Pay Date to identify late payments
- Measure time between Order Request Date and Ship Date to track fulfillment performance
- Analyze duration between Expected Delivery and actual Delivery activity to monitor SLA compliance
- Calculate time between Case Creation timestamp and First Contact activity to measure response times
Settings
Start by going to the 'Log Enrichment' engine by going to any analysis and clicking 'Log Enrichment' in the top right.

Then click 'Add New'

Then choose the enrichment block.
Configuration Options
New Attribute Name: Specify the name of the new attribute you are about to create.
Attribute Name: Select the attribute that specifies a certain timestamp and that you wish to use.
Activity Name: Select the activity that needs to be compared to the selected attribute and for which the duration needs to be calculated.
Activity First or Last: Specify whether the timestamp is taken from the 'First' occurrence of this activity in the case, or the 'Last' occurrence of this activity in the case.
Duration Type: Specify the duration units that will be shown in the new attribute column. It can be hours, days, weeks, etc.
Examples
To calculate the duration between due date and pay date, use the following settings:

In this example:
- New Attribute Name: "Days Since Due Date"
- Attribute Name: "Due Date" (a case attribute containing the expected payment date)
- Activity Name: "Pay Invoice" (the activity when payment occurs)
- Activity First or Last: "Last" (use the last occurrence if payment happens multiple times)
- Duration Type: "Days" (show results in number of days)
Click 'Create' and once you're ready click 'Calculate Enrichment' to add the new attribute to your data set.
The resulting attribute will show positive values for late payments (paid after due date) and negative values for early payments (paid before due date).

The new attribute should now be added to the log and available for use in filters, dashboards, and analysis.
Output
When this enrichment is executed, it creates a new numeric case attribute with the name you specified in "New Attribute Name". The attribute contains the calculated duration between the specified attribute timestamp and the selected activity occurrence.
The duration value is calculated based on the "Duration Type" you selected (hours, days, weeks, etc.). The result can be:
- Positive value: The activity occurred after the attribute timestamp (e.g., late payment)
- Negative value: The activity occurred before the attribute timestamp (e.g., early payment)
- NULL/Empty: If either the attribute or activity is missing in the case
This calculated duration can be used in analysis dashboards, filters, and performance metrics to understand timing relationships in your process.
See Also
Related Duration Enrichments:
- Duration Between Two Activities - Calculate duration between two activity occurrences
- Calculated Attributes - Create custom calculations using attributes
Related Topics:
- Attribute Enrichments - Understanding enrichments in general
- Data Rules - Validating and transforming data
This documentation is part of the mindzie Studio process mining platform.