Calculation in Analytics

The Pricefx Analytics Calculation logics use specific contexts to determine when and how often logic elements execute during a Data Load. Understanding these contexts is essential for optimizing performance and ensuring data is processed correctly across rows and summaries.

Calculation Context

Calculation Context (also referred to as Element Groups) define the execution phase of a logic element. There are three different types:

  • Initialization – The logic runs once for all Init level elements at the start of the process. This context is typically used for setup tasks or fetching global parameters.

  • Row – The logic runs the Row level elements for each row in the dataset. These elements are meant to be inputs and outputs, reading and writing values of a row.

  • Summary – The logic runs once more for all Summary elements after all rows have been processed. This is used for final aggregations or post-processing tasks.

Execution Logic and Circuit Breakers

To optimize performance and not waste time in the calculation, Pricefx employs a circuit breaker mechanism for Row level logic. The system may skip all row level logic runs under specific conditions to reduce processing overhead.

Row Logic Skip Conditions

The system will only run the Initialization and Summary phases and skip the Row phase if:

  1. In the Data Load configuration, specifically the Calculation tab, you did not select anything in Formula Outputs → Target Fields.

  2. There is no Row element matching the selected outputs.

If your logic relies on Row level calculations to update data, ensure that the target fields are correctly mapped in the Calculation tab of the Data Load.

Summary of Execution Flow

Phase

Context

Frequency

Purpose

1

Initialization

Once

Global setup and variable initialization.

2

Row

Per Row

Reading and writing values for individual records.

3

Summary

Once

Final calculations and data aggregation.

AnalyticsCalcLogicDetails.png
Calculation Logic Details

This execution flow applies to non-distributed Analytics Calculation Data Loads. For distributed calculations, the logic may be partitioned across multiple nodes.