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:

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:

  1. Select a process-mining project from the Projects table in the Projects tab.

  2. 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:

  1. Go to Data & Settings > KPIs > Custom metrics.
  2. On the Custom Metric dashboard, click Create a custom metric.
  3. Enter a name for the custom metric in the Name field.
  4. 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.
  5. Optional: Add a description if you need to give any details about the metric.
  6. 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.

  7. Optional: By default a KPI target is minimized. Turn on the KPI target if you want to maximize a target for your KPI.
  8. 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.

  9. Click Test Code to validate the metric
  10. 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.

  11. To select an existing category, do the following steps:
    1. Click Select Existing in the Assign to categories section.
    2. Choose a category by clicking a related category tile.
  12. To create a new category to link custom metric, do the following steps:
    1. Click Create New in the Assign to categories section.
    2. Enter a name in the Name field.
    3. Enter a description in the Description field.
    4. 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, or PNG format.

  13. 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:

  1. Go to Data & Settings > KPIs > Custom metrics.
  2. On the Custom Metric dashboard, click Create a custom metric.
  3. Enter a name for the custom metric in the Name field.
  4. Select one of the following data types from the Data Type drop down:
    Boolean
    To get True or False as 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 duration in milliseconds.
    Amount
    To get the price with the default currency as output.
  5. Optional: Add a description if you need to give any details about the metric.
  6. 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.

  7. Optional: By default a KPI target is minimized. Turn on the KPI target if you want to maximize a target for your KPI.
  8. Enter the SQL code in the Custom metric measure field.
    1. 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.
    2. Optional: Enter a clause in the Where field.
  9. Optional: Turn on the Activity interval.
    1. Select the interval settings by using drop downs.
  10. Optional: Turn on the Keep last event for each case.
  11. Click Test Code to validate the custom SQL query.
  12. 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.

  13. To select an existing category, do the following steps:
    1. Click Select Existing in the Assign to categories section.
    2. Choose a category by clicking a related category tile.
  14. To create a new category to link custom metric, do the following steps:
    1. Click Create New in the Assign to categories section.
    2. Enter a name in the Name field.
    3. Enter a description in the Description field.
    4. 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, or PNG format.

  15. 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:

  1. Go to Data & Settings > KPIs > Custom metrics.
  2. On the Custom Metric dashboard, click Create a custom metric.
  3. Switch to Advanced mode to access the SQL query editor.
  4. Enter a name for the custom metric in the Name field.
  5. Select the appropriate data type from the Data Type drop down (Boolean, Date, Numeric, String, Duration, or Amount).
  6. Optional: Add a description to provide details about the metric.
  7. 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 waittime directly 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_column

    Advanced 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.

  8. Optional: Turn on the Show statistics if you want to view the statistics of the custom metric in the Model tab and Statistics tab.
  9. Optional: By default a KPI target is minimized. Turn on the KPI target if you want to maximize a target for your KPI.
  10. Click Test Code to validate your SQL query and ensure it returns the expected results.
  11. 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.
  12. 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:

  1. Go to Data & Settings > KPIs > Custom metrics.

  2. Click the Edit icon.

  3. 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
  4. Click Next to go to the Additional configuration step.
  5. In the Additional configuration step, you can change the category of your custom metric or create a new category.
  6. 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:

  1. Go to Data & Settings > KPIs > Custom metrics.

  2. In the Custom Metric page, search for the custom metric that you want to delete.

  3. Click the Delete icon to see the Delete custom metric window.

  4. 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:

  1. In the Custom metric dashboard, click the All drop down on the upper left of the window to see the list of categories.

  2. Select a category from the All drop down.