Sales pivot analysis

From XuShuwenn/RedAct · View interactive version

Sales pivot analysis is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Create Excel pivot tables from population and income data for demographic analysis across states and regions.

How to use this skill

Skill file

Sales/Population Pivot Analysis

When to Use

Input Files

Before writing transformation code, inspect both inputs and record the actual schema (column names, sample rows, join keys, and row counts). Do not assume PDF-extracted columns match the requested output field names.

Output

/root/demographic_analysis.xlsx with 5 sheets:

Required source fields before building summaries: STATE, SA2_CODE, SA2_NAME, POPULATION_2023, EARNERS, MEDIAN_INCOME (plus any other original fields carried into SourceData). If a required field is missing, fix the extraction/merge first.

Pre-build data gate: Before creating the workbook, confirm the extracted/merged dataset has expected row counts, complete state names, sensible join results, and the intended population field name from PDF source text. If PDF headers are truncated, repeated header rows leaked into data, STATE values are split/truncated, or join checks show unmatched critical records, stop and fix extraction/cleaning/merge before building any summary sheet.

1. "Population by State"

2. "Earners by State"

3. "Regions by State"

4. "State Income Quartile"

5. "SourceData"

Build and write the validated merged SourceData sheet first as the single enriched source range, then create all requested pivot tables from that shared worksheet data so every summary uses the same cleaned fields and derived columns. Compute Quarter once from the global distribution of valid MEDIAN_INCOME values across the full merged dataset, then reuse that same Quarter field in both SourceData and State Income Quartile.

Compliance requirements

SourceData preservation rule

Verification Before Completion

Verification Before Completion

Before declaring the task done, reopen /root/demographic_analysis.xlsx and verify all of the following:

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.