Anomaly Formula: Amount By Max
What it does:
This rule compares your latest usage with the highest value from your previous usage history (excluding the latest value). If the change exceeds your defined threshold—and matches the direction you’re watching (increase, decrease, or any)—it’s flagged as an anomaly.
When to use it:
Use this formula when you want to know if your current usage surpasses or drops sharply below your previous maximum. Ideal for monitoring cost spikes beyond known limits.
Mathematical Formula:
Let:
• L = Latest Value
• M = Max 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: 40
History: 200, 220, 240
- If Latest Value = 260
 Result: Normal ✅
 Explanation:
 Max: 240
 Change: 260 − 240 = 20
 Absolute Difference (20) < Threshold (40)
- If Latest Value = 300
 Result: Anomaly Detected ❌
 Explanation:
 Max: 240
 Change: 300 − 240 = 60
 Absolute Difference (60) ≥ Threshold (40)
- If Latest Value = 100
 Result: Skipped ☑️
 Explanation:
 Max: 240
 Change: 100 − 240 = −140
 Absolute Difference (140) ≥ Threshold (40)
 But direction = Decrease → does not match “Increased”
Example 2
Change Type: Decreased
Threshold: 30
History: 400, 420, 410
- If Latest Value = 395
 Result: Normal ✅
 Explanation:
 Max: 420
 Change: 395 − 420 = −25
 Absolute Difference (25) < Threshold (30)
- If Latest Value = 360
 Result: Anomaly Detected ❌
 Explanation:
 Max: 420
 Change: 360 − 420 = −60
 Absolute Difference (60) ≥ Threshold (30)
- If Latest Value = 460
 Result: Skipped ☑️
 Explanation:
 Max: 420
 Change: 460 − 420 = 40
 Absolute Difference (40) ≥ Threshold (30)
 But direction = Increase → does not match “Decreased”
Example 3
Change Type: Any
Threshold: 50
History: 100, 110, 120
- If Latest Value = 130
 Result: Normal ✅
 Explanation:
 Max: 120
 Change: 130 − 120 = 10
 Absolute Difference (10) < Threshold (50)
- If Latest Value = 200
 Result: Anomaly Detected ❌
 Explanation:
 Max: 120
 Change: 200 − 120 = 80
 Absolute Difference (80) ≥ Threshold (50)
