Anomaly Formula: Amount By Median
What it does:
This rule compares your most recent usage to the median value of all previous usages. The median is the middle value when your data points are sorted in order. If the difference between your most recent value and the median exceeds your defined threshold, and the change direction matches your selected change type (Increased, Decreased, or Any), an alert is triggered.
When to use it:
This formula is useful when you want to track deviations from a typical usage pattern, especially in scenarios where outliers might affect the average. It helps detect sudden jumps or drops compared to your “middle” data point, which can give a more stable reference than the average.
Mathematical Formula:
Let:
• L = Latest Value
• M = Median of previous values
• T = Threshold
• D = |L − M| (absolute difference)
Anomaly Condition:
D = |L − M| ≥ T
Direction Validation (based on Change Type):
• If Change Type = Increased, condition is valid only if L > M
• If Change Type = Decreased, condition is valid only if L < M
• If Change Type = Any, direction check is not required
Outcomes:
❌Anomaly Detected → D ≥ T and direction matches Change Type
☑️ Skipped → D ≥ T, but direction does not match Change Type
✅ Normal → D < T
Examples:
Example 1
Change Type: Increased
Threshold: 25
History: 90, 100, 110
- If Latest Value = 120
Result: Normal ✅
Explanation:
Median: 100
Change: 120 − 100 = 20
Absolute Difference (20) < Threshold (25)
- If Latest Value = 140
Result: Anomaly Detected ❌
Explanation:
Median: 100
Change: 140 − 100 = 40
Absolute Difference (40) ≥ Threshold (25)
- If Latest Value = 70
Result: Skipped ☑️
Explanation:
Median: 100
Change: 70 − 100 = −30
Absolute Difference (30) ≥ Threshold (25)
But direction = Decrease → does not match “Increased”
Example 2
Change Type: Decreased
Threshold: 30
History: 500, 450, 550
- If Latest Value = 480
Result: Normal ✅
Explanation:
Median: 500
Change: 480 − 500 = −20
Absolute Difference (20) < Threshold (30)
- If Latest Value = 440
Result: Anomaly Detected ❌
Explanation:
Median: 500
Change: 440 − 500 = −60
Absolute Difference (60) ≥ Threshold (30)
- If Latest Value = 560
Result: Skipped ☑️
Explanation:
Median: 500
Change: 560 − 500 = 60
Absolute Difference (60) ≥ Threshold (30)
But direction = Increase → does not match “Decreased”
Example 3
Change Type: Any
Threshold: 35
History: 200, 230, 240
- If Latest Value = 250
Result: Normal ✅
Explanation:
Median: 230
Change: 250 − 230 = 20
Absolute Difference (20) < Threshold (35)
- If Latest Value = 280
Result: Anomaly Detected ❌
Explanation:
Median: 230
Change: 280 − 230 = 50
Absolute Difference (50) ≥ Threshold (35)