Freight Cost Distortion Agent (Formula Expressions)

This page provides summary of the Formula Expressions used in the Freight Cost Distortion Agent (Reference) .

Avg Margin %

Definition

:question_mark:

Weighted average gross margin percentage across the evaluated transactions, calculated as total gross margin divided by total invoice price for the filtered dataset.

Formula

SUM(GrossMargin) / NULLIF(SUM(InvoicePrice), 0)

Current Freight Cost Rate

Definition

:question_mark:

Current freight cost rate for the evaluated transactions, calculated as total freight cost divided by total invoice price for the filtered dataset. This expresses freight cost as a share of realized revenue.

Formula

SUM(Freight_Cost) / NULLIF(SUM(InvoicePrice), 0)

Freight To Margin Ratio

Definition

:question_mark:

Overall freight-to-margin ratio for the evaluated transactions, calculated as total freight cost divided by total gross margin. It indicates how much of the gross margin is consumed by freight costs.

Formula

SUM(Freight_Cost) / NULLIF(SUM(GrossMargin), 0)

IQR Freight To Margin

Definition

:question_mark:

Interquartile range (IQR) of the transaction-level freight-to-margin ratio, calculated as the difference between the 75th (Q3) and 25th (Q1) percentiles of the transaction-level ratio. It captures the spread of typical freight burden and supports definition of outlier thresholds.

Formula

PERCENTILE_CONT(Freight_Cost / NULLIF(GrossMargin, 0), 0.75) - PERCENTILE_CONT(Freight_Cost / NULLIF(GrossMargin, 0), 0.25)

Q3 Freight To Margin Ratio

Definition

:question_mark:

75th percentile (third quartile, Q3) of the transaction-level freight-to-margin ratio. It represents an upper bound of “normal” freight burden and is commonly used as a benchmark or threshold in detection rules.

Formula

PERCENTILE_CONT(Freight_Cost / NULLIF(GrossMargin, 0), 0.75)

Freight To Margin 90th Percentile

Definition

:question_mark:

90th percentile of the transaction-level freight-to-margin ratio. It highlights extreme but still typical high-freight cases and can be used to set stricter outlier thresholds.

Formula

PERCENTILE_CONT(Freight_Cost / NULLIF(GrossMargin, 0), 0.9)

Q3 Freight %

Definition

:question_mark:

75th percentile (third quartile, Q3) of the transaction-level freight cost rate, calculated as freight cost divided by invoice price. It serves as a benchmark or recommended upper bound for acceptable freight % within a product group.

Formula

PERCENTILE_CONT(Freight_Cost / NULLIF(InvoicePrice, 0), 0.75)