metricengine.calculations.variance
Variance and analysis calculations.
This module contains calculations for variance analysis, percentage changes, and related metrics. All calculations use the Collection namespace for proper organization.
- metricengine.calculations.variance.variance_amount(actual, expected)[source]
Variance amount = actual - expected
- Return type:
FinancialValue[TypeVar(U, bound=Unit)]
- metricengine.calculations.variance.variance_ratio(actual, expected)[source]
Variance ratio = (actual - expected) / expected
- Return type:
- metricengine.calculations.variance.variance_percentage(variance_ratio)[source]
Variance as percent (positive = over, negative = under).
- Return type:
- metricengine.calculations.variance.percentage_change_ratio(old_value, new_value)[source]
Percentage change (ratio) = (new_value - old_value) / old_value
- Return type:
- metricengine.calculations.variance.percentage_change(percentage_change_ratio)[source]
Percentage change as percent (e.g., 0.20 -> ‘20%’).
- Return type:
- metricengine.calculations.variance.variance_ratio_from_components(actual_closing, opening, purchases, sold)[source]
- Return type:
- Variance ratio from inventory components:
expected_closing = opening + purchases - sold variance_ratio = (actual_closing - expected_closing) / expected_closing
- metricengine.calculations.variance.variance_percentage_from_components(vrc)[source]
Variance (from components) as percent.
- Return type: