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
-
Open the Workstation page.
- In the Navigation pane, click Scripts.
- Click Create Script.
- Click Settings.
- 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.
- A template opens depending on the selected Subtype.
- Add and edit Variables as needed and define Settings as needed.
- If you make changes, click Overwrite in the warning dialog.
- Click Save.
Create a Metric Using the Python Scripts
-
Open the Workstation page.
- In the Navigation pane, click Objects.
- In the top right corner, click Create New Object.
To edit an existing metric instead, find the metric and double-click it.
- In the Create New window, if you are connected to multiple projects, select the project from the drop-down list on the left.
- Click Metric.
- In the right pane, click Functions.
- Expand the functions drop-down list and click Analytical Functions.
-
Hover over a function and click Add.
You can also type the function template in the metric editor dialog and skip to step 13.
- If you defined default values in the python script above, the default values display. Make changes to the function, as needed.
- Click Insert.
- Define your metric options. For more information on these options, see Create a Stand-Alone Metric.
- Click OK.
