Long-period spend analysis (>1 year)

Analyzes spending over periods exceeding 1 year by working around the 366-day API limit. Automatically aggregates results from multiple successive calls.

โ†“ Download skill (.md)
86/100ยท๐Ÿ” Ad hocยทIntermediateCFOFinance Analyst
Spend analysisReportsspendesk_analyze_spend

๐ŸŽฏ Skill purpose

Analyzes spending over periods exceeding 1 year by working around the 366-day API limit. Automatically aggregates results from multiple successive calls.

๐Ÿ“Š What it produces

Aggregated spending table by category, supplier, or team across the full requested period, with no gaps.

โšก Benefit

Before

Impossible to get more than one year of data in one call โ€” manual quarterly analysis in Excel.

After

Complete multi-year analysis automatically reconstructed in a single Claude prompt.



# Instructions โ€” Spend analysis over a long period (> 1 year)

## โš ๏ธ Strict limit: 366 days maximum

`spendesk_analyze_spend` returns an explicit error if the period exceeds 366 days:
```
"fromDate must be on or before toDate, and the range cannot exceed 366 days."
```

**Solution**: split into sub-periods โ‰ค 366 days, call separately, combine the results.

## โš ๏ธ Second gotcha: limit=10 by default

For a groupBy=month over 12 months, the 2 least significant months are aggregated into an "Others" row.
โ†’ Always pass `limit: 12` for a complete annual month-by-month analysis.
โ†’ For 2 years: combine two calls with `limit: 12` each.

## Step 1 โ€” Calculate the sub-periods

Rule: each sub-period โ‰ค 365 days (leave a 1-day margin).

Examples:
- 2024 analysis: fromDate=2024-01-01, toDate=2024-12-31 โœ… (365 days)
- 2025 analysis: fromDate=2025-01-01, toDate=2025-12-31 โœ… (364 days)
- 2026 YTD analysis: fromDate=2026-01-01, toDate=2026-07-06 โœ… (186 days)

## Step 2 โ€” Call each sub-period (in parallel if possible)

For each sub-period:
```json
{
  "companyId": "...",
  "fromDate": "YYYY-MM-DD",
  "toDate": "YYYY-MM-DD",
  "groupBy": ["month"],
  "limit": 12
}
```

## Step 3 โ€” Combine the results

**Only combine after obtaining all results** (do not present a partial view).

Aggregation:
- `totalAmount`: sum the `summary.totalAmount.amount` of each sub-period (same functional currency)
- `totalCount`: sum the `summary.totalCount`
- Rows by month: concatenate the `data[]` arrays from both calls (no duplicates โ€” distinct periods)

โš ๏ธ If a sub-period contains an "Others" row: the month-by-month breakdown is **partial** for that period. Increase `limit` or narrow the period.

## Step 4 โ€” Year-over-year comparison

To compare 2024 vs 2025:
- Call 1: fromDate=2024-01-01, toDate=2024-12-31
- Call 2: fromDate=2025-01-01, toDate=2025-12-31
- Change = (totalAmount_2025 - totalAmount_2024) / totalAmount_2024 ร— 100

Alternative: use `compareWithPreviousPeriod=true` on a period โ‰ค 366 days (automatically compares with the equivalent previous period).

## Live example (real data for this account)

| Period | Total (EUR) | # payables |
|---------|-------------|-------------|
| 2025 (Jan-Dec) | EUR 17,916,500.61 | 6,359 |
| 2026 (Jan-Jun) | EUR 8,174,523.65 | 3,937 |

Note: in the 2025 results, the default `limit=10` โ†’ May and Sept. (the 2 least significant) fell into "Others". With `limit=12`, all months are visible.

## Example prompt

- "Analyze our spend over the last 2 years" โ†’ 2 calls, year by year
- "Spend report 2024 vs 2025" โ†’ 2 calls + comparison
- "Monthly trend since January 2024" โ†’ split into 2 periods + limit=12

How to install this skill

/
  1. 1
    Download the file s04-analyze-spend-periode-longue.md using the button above.
  2. 2
    Place the file in the .claude/ directory of your project (or ~/.claude/ for a global install).
    cp s04-analyze-spend-periode-longue.md .claude/s04-analyze-spend-periode-longue.md
  3. 3
    Use in Claude Code โ€” the skill is automatically discovered. Describe your need in natural language and Claude will apply the skill instructions.
๐Ÿ’ก Make sure the Spendesk MCP is configured in your .claude/settings.json with the tools spendesk_analyze_spend.

Similar skills

โ˜… Top
95/100ยท๐Ÿ” Ad hocยทExpert

MCP coverage audit & gap analysis

Probes all available MCP tools, re-evaluates coverage of 50 persona use cases, detects new fields or tools, and regenerates the gap analysis report.

CFOControllerAP Manager
90/100ยท๐Ÿ“… WeeklyยทBeginner

Card requests via get_requests

Explains how to use get_requests for card requests and why expense reimbursements don't appear there. Avoids a frequent source of confusion between two distinct workflows.

ControllerFinance Analyst
90/100ยท๐Ÿ” Ad hocยทIntermediate

Active vs archived cost centers

Distinguishes active cost centers from archived ones with correct use of get_cost_centers. Avoids the counter-intuitive isArchived vs isActive naming convention pitfall.

ControllerFinance Analyst