Example: Top 5 Customers by Sales
This example builds a data extraction from scratch, covering the workbook setup, the extraction table, the filters, and a margin percentage calculation. The finished table ranks the top 5 customers by sales for a selected year and month, along with their margin percentage, and the pie chart updates automatically whenever the filter values change.
important
To follow along, the Invoice Analysis data model needs to be installed and accessible in the environment.
01
Prepare the workbook
Two cells hold the year and month, to be referenced as filters later. Once referenced, changing either cell updates the results automatically.
- Select Classeurs in the navigation panel.
- Right click and select New Workbook.
- Name the workbook
Top 5 Customersand click Save. - In cell A5, enter
Year, and in cell B5, enter2024. - In cell A6, enter
Month, and in cell B6, enter4. - (Optional) Apply any formatting, such as a title or fill colors.

02
Create the extraction table
The extraction identifies each customer and totals their transactions, grouped by Customer Code and Customer Name with the three ledger fields summed.
- Select cell A9.
- Select the Analysis tab, then click Data Extraction Wizard.
- In Environment, select Current Environment.
- In Data Model, select Invoice Analyses.
- Name the extraction
Customers. - In the Fields tab, search and add the following fields:
- Customer Code
- Customer Name
- Ledger Currency Amount
- Ledger Currency Cost
- Ledger Currency Margin Amt
- Under Order By, leave every field as None.
- Under Aggregation, untoggle the three ledger fields and set them to Sum.
- Click Create.
- (Optional) Apply any formatting.

03
Add filters
Adding filters connects the extraction to the Year and Month cells. Once connected, changing either cell updates the extraction results automatically.
- Select any cell in the extraction table.
- In the Analysis tab, click Data Extraction Wizard.
- Click the Filters tab, then Add Filter.
- In the first dropdown, search for the Year field.
- Keep the operator as
=and click cell B5 directly in the sheet. - Click Add filter to add another one.
- Search for the Month field and click cell B6.
- Click Update.

04
Filter to June 2025
Filtering to June 2025 narrows the extraction to that month's transactions, showing which customers ranked highest during that period.
- In cell B5, change the year to
2025. - In cell B6, change the month to
6. - The table refreshes automatically with the updated results.

05
Add a margin percentage column
The formula divides the margin amount by the ledger amount for each customer, turning the two raw totals into a single percentage that shows how profitable each customer is.
- Right click the last column header cell E9.
- Hover over Insert and click Table Columns to the Right.
- Rename the new column header to
Margin Percentage. - In the first row of the new column, enter
=E10/C10. - Select the whole F column.
- In the Home tab, select Percentage from the Number dropdown.

06
Limit to top 5 customers
Setting a Top X value narrows the table to the highest ranked customers by ledger currency amount.
- Select any cell in the extraction table.
- In the Analysis tab, click Data Extraction Wizard.
- Under Options, set Top X to
5. - Click Update.

07
Build a pie chart
The chart is linked to the extraction data. Changing the year or month filter values updates both the table and the chart automatically.
- Select the Customer Name and Ledger Currency Amount columns.
- Select the Insert tab, and click Charts.
- Under Pie, select the pie chart, then click Ok.
- (Optional) Click the new chart, and in the Chart Design tab, apply any formatting.
- Move the chart on the sheet as needed.
