This page provides summary of the Formula Expressions used in the Regional Margin Variance Agent (Reference).
Avg Margin %
Definition
Average margin rate for the evaluated scope (typically region–customer–product group), used as a baseline measure of current margin performance.
Formula
SUM(GrossMargin) / NULLIF(SUM(InvoicePrice), 0)
Standard Deviation Margin %
Definition
Population standard deviation of transaction-level margin rates within the evaluated scope, showing how dispersed individual transaction margins are around the mean.
Formula
STDDEV_POP(GrossMargin / NULLIF(InvoicePrice, 0))
IQR Margin %
Definition
Interquartile range (IQR) of transaction-level margin rates for the evaluated scope, calculated as the difference between the 75th and 25th percentiles. This is the core spread measure used for Tukey-style outlier detection in the agent’s methodology.
Formula
PERCENTILE_CONT(GrossMargin / NULLIF(InvoicePrice, 0), 0.75) - PERCENTILE_CONT(GrossMargin / NULLIF(InvoicePrice, 0), 0.25)
Quartile 1 Margin %
Definition
25th percentile (Q1) of transaction-level margin rates in the evaluated scope, representing the lower quartile margin benchmark used as the “minimum acceptable” regional margin level in the Tukey test and uplift logic.
Formula
PERCENTILE_CONT(GrossMargin / NULLIF(InvoicePrice, 0), 0.25)
Quartile 3 Margin %
Definition
75th percentile (Q3) of transaction-level margin rates in the evaluated scope, representing the upper quartile margin benchmark for the regional margin distribution used in the Tukey/IQR-based outlier identification.
Formula
PERCENTILE_CONT(GrossMargin / NULLIF(InvoicePrice, 0), 0.75)
MarginVarianceToMinimum
Definition
Difference between the lower Tukey fence (Q1 − 1.5 × IQR) for the region and the customer’s average margin rate. This quantifies how far below even the “minimum acceptable” regional margin level a customer’s average margin is, and is used to detect clear underperformers according to the Tukey range test methodology.
Formula
(s2.FirstQuartileMarginRate - (1.5 * s2.IQRmarginRate)) - s1.AvgMarginPct
Margin Uplift
Definition
Absolute profit improvement that would result if an underperforming customer’s average margin rate were moved toward the regional benchmark (typically by averaging the current customer margin with the regional margin benchmark). It represents the additional margin that could be captured for that customer or segment.
Formula
((s1.Revenue * (s1.AvgMarginPct + s2.AvgMarginPct) / 2) - s1.Profit)
MarginLiftPotentialPct
Definition
Relative margin improvement potential, expressed as a percentage of current profit. It compares the hypothetical profit after lifting the customer toward the regional margin benchmark against today’s profit to show how much margin could be improved in percentage terms.
Formula
(s1.Revenue * (s1.AvgMarginPct + s2.AvgMarginPct) / 2) / NULLIF(s1.Profit, 0)- 1
Revenue Uplift
Definition
Absolute revenue-equivalent uplift expressed using the same calculation as Margin Uplift (difference between potential profit at the improved margin rate and current profit). It can be used as an alternative monetary view of the margin recovery opportunity for each customer.
Formula
((s1.Revenue * (s1.AvgMarginPct + s2.AvgMarginPct) / 2) - s1.Profit)
Suggested Margin %
Definition
Target margin rate suggested for the customer, derived by moving the customer’s current average margin toward the regional average benchmark (typically the midpoint between customer and regional averages). This is the margin rate the agent recommends to close part of the gap while remaining realistic and aligned with regional performance.
Formula
((s1.Revenue * ((s1.AvgMarginPct + s2.AvgMarginPct) / 2)) / NULLIF(s1.Revenue, 0))