Anomaly Formula: Percentage By Max

What it does:

This rule compares the latest value in your usage history with the maximum historical value. If the percentage change from the maximum value meets or exceeds your defined threshold and the change direction matches what you’ve selected, an anomaly is detected.

 

When to use it:

Use this formula when you want to detect spending that significantly increases or decreases compared to your historical maximum. This is ideal for spotting spikes or sudden recoveries.

 


Mathematical Formula:

 

Let:

 L = Latest Value
 M = Maximum Value in History
 T = Threshold (as a percentage)
•  = Percentage Change
•  = (|L − M| / M) × 100

 

Anomaly Condition:

%Δ ≥ 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 → %Δ ≥ T and direction matches Change Type
☑️ Skipped → %Δ ≥ T, but direction does not match Change Type
✅ Normal → %Δ < T

 


Examples:

 

Example 1

Change Type: Increased
Threshold: 10%
History: 180, 200, 220

 

  • If Latest Value = 230
    Result: Normal ✅
    Explanation:
      M = 220
      %Δ = (230 − 220) / 220 × 100 = 4.55%
      Percentage Change (4.55%) < Threshold (10%)

 

  • If Latest Value = 250
    Result: Anomaly Detected ❌
    Explanation:
      M = 220
      %Δ = (250 − 220) / 220 × 100 = 13.64%
      Percentage Change (13.64%) ≥ Threshold (10%)

 

  • If Latest Value = 180
    Result: Skipped ☑️
    Explanation:
      M = 220
      %Δ = |180 − 220| / 220 × 100 = 18.18%
      Percentage Change (18.18%) ≥ Threshold (10%)
      But direction = Decrease → does not match “Increased”

Example 2
Change Type: Decreased
Threshold: 15%
History: 150, 180, 210

 

  • If Latest Value = 200
    Result: Normal ✅
    Explanation:
      M = 210
      %Δ = (210 − 200) / 210 × 100 = 4.76%
      Percentage Change (4.76%) < Threshold (15%)

 

  • If Latest Value = 170
    Result: Anomaly Detected ❌
    Explanation:
      M = 210
      %Δ = (210 − 170) / 210 × 100 = 19.05%
      Percentage Change (19.05%) ≥ Threshold (15%)

 

  • If Latest Value = 230
    Result: Skipped ☑️
    Explanation:
      M = 210
      %Δ = |230 − 210| / 210 × 100 = 9.52%
      Percentage Change (9.52%) < Threshold (15%)
      But direction = Increase → does not match “Decreased”

Example 3
Change Type: Any
Threshold: 12%
History: 500, 550, 600

 

  • If Latest Value = 620
    Result: Normal ✅
    Explanation:
      M = 600
      %Δ = (620 − 600) / 600 × 100 = 3.33%
      Percentage Change (3.33%) < Threshold (12%)

 

  • If Latest Value = 680
    Result: Anomaly Detected ❌
    Explanation:
      M = 600
      %Δ = (680 − 600) / 600 × 100 = 13.33%
      Percentage Change (13.33%) ≥ Threshold (12%)