Preview Feature: Use Python Scripts as Reusable Functions for Metric Calculations

Strategy (October 2026) introduces support for Python-based reusable functions for metric calculations in Workstation. Administrators can now deploy Python scripts as shared functions in Workstation, replacing the existing legacy R integration for metrics. Built on the new Python Service infrastructure, this capability lets analytic architects create and manage Python scripts in the Script Editor, define standalone Python-based metrics, and enable business analysts to build derived metrics using these Python functions.

View and Edit Python Script Templates

  1. Open the Workstation page.

  2. In the Navigation pane, click Scripts.
  3. Click Create Script.
  4. Click Settings.
  5. Define values in the following fields to display the metric function script templates:
    • Script Type: Choose Analytical Functions.
    • Subtype: Choose one of the following subtypes for your metric:
      • AggregationFunction: For scripts that use vectors for the inputs and a scalar output.
      • SimpleFunction: For scripts that use scalar for the input and output.
      • RelativeFunction: For R scripts that use vectors for the input and output.
    • Result Type: Choose if you want the result to produce Text, Number, or Date outputs.
    • Script Description: Type a short description for the metric calculation.
    • Python Runtime: Choose your python version.
  6. A template opens depending on the selected Subtype.
  7. Add and edit Variables as needed and define Settings as needed.
  8. If you make changes, click Overwrite in the warning dialog.
  9. Click Save.

Create a Metric Using the Python Scripts

  1. Open the Workstation page.

  2. In the Navigation pane, click Objects.
  3. In the top right corner, click Create New Object.
    • To edit an existing metric instead, find the metric and double-click it.

  4. In the Create New window, if you are connected to multiple projects, select the project from the drop-down list on the left.
  5. Click Metric.
  6. In the right pane, click Functions.
  7. Expand the functions drop-down list and click Analytical Functions.
  8. Hover over a function and click Add.

    You can also type the function template in the metric editor dialog and skip to step 13.

  9. If you defined default values in the python script above, the default values display. Make changes to the function, as needed.
  10. Click Insert.
  11. Define your metric options. For more information on these options, see Create a Stand-Alone Metric.
  12. Click OK.