detect_margin_erosion
Flag items whose gross profit percentage drops beyond a threshold over recent months, using trend analysis to highlight products at risk of unprofitability.
Instructions
Detect items whose gross profit percentage has declined by more than a threshold over recent months. Uses linear regression on per-item monthly GP% to identify a downward trend — flags items at risk of becoming unprofitable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| months | No | Analysis window in months (default 12, max 24) | |
| erosionThresholdPct | No | Minimum GP% drop to flag as eroding (default 5) |