Custom metrics
Custom metrics are a feature in IBM Process Mining that helps you to apply a custom SQL query at the case level of a project to create a business metric. You can create the SQL query by using the available data in IBM Process Mining to compute a user-defined result. Therefore, you must know SQL and the data structures in IBM Process Mining to create a custom metric.
You can use custom metrics for the following activities in IBM Process Mining:
- Applying filters
- Comparing process models
- Viewing process statistics
- Creating an analytics dashboard
- Creating a backup of the project
You can use custom metric created with SQL based on MonetDB taxonomy to compute your own metrics and then use them in the widget and dashboard filters. For more information, see MonetDB taxonomy.
Using custom metrics in a project might impact the performance of process analysis. To maintain optimum performance, limit the number of custom metrics and ensure their SQL query is optimized.
The following table shows the default custom metrics that are created when you load a data source into a new project:
| Custom metric | Dimension | Description |
|---|---|---|
| Total events | Project | A metric indicates the total number of events in your project. |
| Total cases | Project | A metric indicates the total number of cases in your project. |
| Total completed cases | Project | A metric indicates the total number of completed cases in your project. |
| Total running cases | Project | A metric indicates the total number of running cases in your project. |
| Reworks | Case ID | A metric indicates the number of repeated activities. In Prescriptive Process Mining you get insights on how you can reduce reworks and how reworks impact other Key Performance Indicators (KPIs). |
The following sections explain the tasks that you can do in the Custom Metric section in IBM Process Mining:
Accessing the Custom metric dashboard
To access the Custom metric dashboard, do the following steps:
-
Select a process-mining project from the Projects table in the Projects tab.
-
Go to Data & Settings > KPIs > Custom metrics.
Creating a custom metric
You can create a custom metric in IBM Process Mining by using Guided mode, Editor mode, and Advanced mode.
Creating a custom metric in guided mode
To create a custom metric by choosing any two activities, do the following steps:
- Go to Data & Settings > KPIs > Custom metrics.
- On the Custom Metric dashboard, click Create a custom metric.
- Enter a name for the custom metric in the Name field.
- Select one of the following measures from the Measure drop down:
- Time
- To get an average time between two activities, based on the activity interval.
- Cost
- To get a total cost in the period between two activities, based on the activity interval.
- Optional: Add a description if you need to give any details about the metric.
- Optional: Turn on the Show statistics if you want to view the statistics of the custom
metric in the Model tab and Statistics tab. Statistics can only be enabled if the
dimension is Case ID or Event.
The Show statistics switch does not impact the use of the custom metrics in the Analytics, Prescriptive, and Cockpits pages.
- Optional: By default a KPI target is minimized. Turn on the KPI target if you want to maximize a target for your KPI.
- Select the activities that you want to use for your custom metric. Choose a start and end
activities from the drop downs.
The Activity interval switch is unavailable because Guided mode measures require a specific activity range.
- Click Test Code to validate the metric
- Click Next to go to the Additional configuration step.
In the Assign to categories section, you can select between Select Existing category and the Create New category.
By default, IBM Process Mining categorizes the custom metrics in the General metrics category.
- To select an existing category, do the following steps:
- Click Select Existing in the Assign to categories section.
- Choose a category by clicking a related category tile.
- To create a new category to link custom metric, do the following steps:
- Click Create New in the Assign to categories section.
- Enter a name in the Name field.
- Enter a description in the Description field.
- Select an existing icon or add an icon in the Icon field.
The maximum file size of the icon that you can upload is 200 KB. You can upload only the
SVG,JPG,JPEG, orPNGformat. - Create the custom metric.
You can see details of the created custom metric under the assigned category. To do so, go to the Custom metrics table in the Custom metrics page.
Creating a custom metric in editor mode
To create a detailed custom metric measure, do the following steps:
- Go to Data & Settings > KPIs > Custom metrics.
- On the Custom Metric dashboard, click Create a custom metric.
- Enter a name for the custom metric in the Name field.
- Select one of the following data types from the Data Type drop down:
- Boolean
- To get
TrueorFalseas output based on the query. - Date
- To get the date as output in the
<YYYY-MM-DDTHH:mm:ss.sssZ>format. - Numeric
- To get an integer or decimal number as output.
- String
- To get the text string as output.
- Duration
- To get the duration (in milliseconds) as output. When you select this data type, IBM Process Mining generates the
custom metric result as a
durationin milliseconds. - Amount
- To get the price with the default currency as output.
- Optional: Add a description if you need to give any details about the metric.
- Optional: Turn on the Show statistics if you want to view the statistics of the custom
metric in the Model tab and Statistics tab.
The Show statistics switch does not impact the use of the custom metrics in the Analytics, Prescriptive, and Cockpits pages.
- Optional: By default a KPI target is minimized. Turn on the KPI target if you want to maximize a target for your KPI.
- Enter the SQL code in the Custom metric measure field.
- Select a value from Group by drop down to complete the SQL query.You can group by Case ID, Event, Project, by any event log column, as well as Resource and Role.Note:
- If you group by CaseID, the custom metric is created in the case_stats table (where CaseID is the primary key).
- If you group by Event, the custom metric is created in the event log table (one value for each event).
- If you group by Project, the custom metric is created in the project table, and it has one unique value for your entire project.
- If you group by any other event log column, you are going to create an additional table called
$column_stats, where the primary key is defined by the values of the column itself, and joined with the event log consequently. All future custom metrics grouped by that column will be stored in this new table.
Note: When you create custom metrics that are grouped by any event log column or the Event value, a case distinct function will be applied in the background after the creation of the custom metric only if the metric's measure includes a function at case-level. - Optional: Enter a clause in the Where field.
- Select a value from Group by drop down to complete the SQL query.
- Optional: Turn on the Activity interval.
- Select the interval settings by using drop downs.
- Optional: Turn on the Keep last event for each case.
- Click Test Code to validate the custom SQL query.
- Click Next to go to the Additional configuration panel.
In the Assign to categories section, you can select between Select Existing category and the Create New category.
By default, IBM Process Mining categorizes the custom metrics in the General metrics category.
- To select an existing category, do the following steps:
- Click Select Existing in the Assign to categories section.
- Choose a category by clicking a related category tile.
- To create a new category to link custom metric, do the following steps:
- Click Create New in the Assign to categories section.
- Enter a name in the Name field.
- Enter a description in the Description field.
- Select an existing icon or add an icon in the Icon field.
The maximum file size of the icon that you can upload is 200 KB. You can upload only the
SVG,JPG,JPEG, orPNGformat. - Create the custom metric.
You can see details of the created custom metric under the assigned category. To do so, go to the Custom metrics table in the Custom metrics page.
Creating a custom metric in advanced mode
Advanced mode allows you to create custom metrics by directly writing SQL queries with full access to object tables and database schema. This mode provides maximum flexibility for complex metric definitions.
To create a custom metric using advanced mode, do the following steps:
- Go to Data & Settings > KPIs > Custom metrics.
- On the Custom Metric dashboard, click Create a custom metric.
- Switch to Advanced mode to access the SQL query editor.
- Enter a name for the custom metric in the Name field.
- Select the appropriate data type from the Data Type drop down (Boolean, Date, Numeric, String, Duration, or Amount).
- Optional: Add a description to provide details about the metric.
- Write your SQL query in the SQL Query editor.
The SQL query editor provides the following features:
- Schema suggestions
- The editor automatically suggests available tables and columns from your data structures as you type, making it easier to reference the correct database objects.
- Object table support
- Include object tables in your SELECT, FROM, and GROUP BY clauses, enabling more granular analysis. When you create a custom metric in advanced mode where the GROUP BY clause uses the primary key of an object table, the resulting column is automatically added to that object table instead of creating a separate attribute statistics table. This simplifies your data structure and enables more efficient queries.
- Automatic dimension and measure detection
- The system automatically identifies dimensions and measures from your query. For the measure column, you can use any alias name. Dimension columns can be used with or without aliases.
- Multiple dimensions
- Include multiple columns in the GROUP BY clause to create multi-dimensional custom metrics.
- Computed columns
- Access computed columns such as
waittimedirectly from the eventlog table in your SQL queries.
Important: Your SQL query must follow the following requirements:- Include at least one measure in the SELECT clause (the aggregated value you want to calculate).
- Include at least one dimension in the GROUP BY clause (the level at which the metric is calculated).
- Use valid MonetDB SQL syntax. For more information, see MonetDB SQL Manual.
The following example shows the general structure of an SQL query for advanced mode:
SELECT dimension_column, AGGREGATE_FUNCTION(measure_column) as metric_name FROM eventlog el JOIN object_table ot ON el.column = ot.column WHERE condition GROUP BY dimension_columnAdvanced mode allows you to write complete SQL queries that can include object tables from your data source, enabling you to create metrics based on data that extends beyond the standard event log structure.
- Optional: Turn on the Show statistics if you want to view the statistics of the custom metric in the Model tab and Statistics tab.
- Optional: By default a KPI target is minimized. Turn on the KPI target if you want to maximize a target for your KPI.
- Click Test Code to validate your SQL query and ensure it returns the expected results.
- In the Assign to categories section of the Additional configuration menu, select an existing category or create a new one to organize your custom metric.
- Create the custom metric.
You can see details of the created custom metric under the assigned category in the Custom metrics table on the Custom metrics page.
Editing a custom metric
You can edit custom metrics created in any mode (Guided, Editor, or Advanced). When you edit a custom metric, it opens in the mode it was originally created in, or you can switch to Advanced mode for full SQL editing capabilities. To edit a custom metric, do the following steps:
-
Go to Data & Settings > KPIs > Custom metrics.
-
Click the Edit icon.
-
In the Edit custom metric dialog, you can change the following fields in the Details step:
- Description field
- Show statistics toggle
- KPI target toggle
- Custom metric measure field
- Group by drop down
- Where clause field
- Activity interval toggle and drop downs
- Keep last event for each case toggle
- Click Next to go to the Additional configuration step.
- In the Additional configuration step, you can change the category of your custom metric or create a new category.
- Save your changes.
Deleting a custom metric
When you delete a custom metric, the output of the existing Analytics widgets, which apply to the deleted custom metric becomes invalid. Also, the associated project filters are deleted.
To delete a custom metric, do the following steps:
-
Go to Data & Settings > KPIs > Custom metrics.
-
In the Custom Metric page, search for the custom metric that you want to delete.
-
Click the Delete icon to see the Delete custom metric window.
-
Delete the custom metric.
When you restore a custom-metric based backup of a process model, IBM Process Mining re-creates only the custom metrics that are relevant to the selected project.
Filtering custom metrics by category
To filter custom metrics by category, do the following steps:
-
In the Custom metric dashboard, click the All drop down on the upper left of the window to see the list of categories.
-
Select a category from the All drop down.