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.
Preview features are early versions of features and are not to be used in a production environment as the core behavior remain subject to change between preview and GA. By selecting to expose preview features in Strategy Workstation, you can access these features and use them as you would any other dashboard functionality. The official versions of preview features are included in subsequent releases.
View and Edit Python Script Templates
- Open the Workstation window and connect to an environment.
- In the Navigation pane, click
, next to Scripts. - Choose an environment from the Environment drop-down list and click Select.
- 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 window.
- From the File menu, select New Metric.
- To edit an existing metric instead, find the metric and double-click it.
- If you are connected to multiple environments or projects, select an environment and project. The Metric Editor dialog box opens.
- 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.
