---
id: agencias/rentabilidade-por-cliente
industry: Marketing agencies
usage: specific
effort: high
grain: Client (CNPJ) x accrual month for margin; client x week x person for effort
---

# Profitability per client

How much each client earns after the cost of serving them, with effort measured the way the data allows and the number's coverage always alongside.

## Executive summary

**For:** Partners and operations at agencies who want to know which clients consume more than they pay.

**What it solves**

- A margin per client that ties to the agency's real cost and revenue.
- Effort comparable across clients, even without time entries.
- Every number says how much of the base it covers, so nobody decides on 1% of the data.

**Why it matters:** The retainer is negotiated once and the effort grows every month. Without crossing what each client pays with what they consume, the agency renews contracts at a loss and allocates the team to whichever client complains most. It is the question behind price increases, client exits and hiring.

**Business questions it answers**

- Which clients have high effort and a low retainer?
- What is each client's margin over the last 12 months?
- How much of our margin depends on media commission?
- How much time did the team spend on client X this month, and on what?
- Which media buyer made the most changes to ad accounts this week?
- How many rework requests did the client make this quarter?

**What you need**

- The agency's finance data connected, with revenue and expense classification
- At least one source of effort: job ERP, task manager or the ad accounts' activity log
- Revenue per client from the portfolio case, with CNPJ as the key

**What you get**

- A client x accrual month table with revenue, allocated cost, margin and a reason when one side is missing
- Effort by client, person and activity type, with the measurement source declared
- A client ranking by window margin, not monthly margin
- An internal AI agent that answers about margin with the right caveats

## Detailed

### The problem

Almost no agency logs hours for real: in one real base, less than 1% of deliverables had any time recorded. Finance revenue mixes retainers, media commission and third-party money that only passes through the account, and the client appears under the legal name, which does not match the name in the job system. Whoever crosses logged hours with the whole invoice gets a margin with the wrong sign, and whoever uses an inner join loses half of the client-months without noticing.

### Business rules

1. **Agency revenue is net of pass-through.** Ad delivery and boosting billed on the client's behalf, pass-through media budget and production paid to third parties stay out of both sides: they are neither revenue nor cost. Media commission is agency revenue; confirm it through the finance subcategory and by the absence of payments to the media vendor in the same base. Also show the margin without media commission, which measures how much the agency depends on it. (Avoid: Adding gross media inflow as client revenue.)
2. **Cost is a declared allocation, not a measurement.** Allocate the month's real operating cost across the deliverables (pieces, jobs) recorded in the month. Where a deliverable has a list price, use it as a complexity weight within the priced subset; unpriced deliverables get the simple allocation. The sum of allocated cost ties exactly to the month's cost. Record each row's route (weighted or simple). Partner draws are not cost and come out after margin. (Avoid: Spreading the month's cost only across deliverables that have a list price.)
3. **A month without complete expenses has no cost.** Treat a month as closed when its number of expense entries reaches at least 30% of the median of recent months. An open month gets a null cost with a written reason, never zero: zero would make the current month's margin explode. (Avoid: Computing margin for the current month with half the expenses posted.)
4. **Logged hours only with coverage alongside.** Publish the coverage of each effort measure: hours logged over deliverables, actions over accounts. If hours cover a small fraction of deliverables, they cannot support cost per hour. Hourly cost and allocated cost sit side by side for comparison and are never added: they are the same cost by two paths. (Avoid: Cost per hour computed from hours that cover 1% of deliverables.)
5. **No hours, effort from human actions on the accounts.** Media agencies without timesheets can measure effort through the ad accounts' activity log: count only actions by people (actor_name different from Meta itself) and split ad creation, status changes and budget changes. Convert with a declared factor (for example, 1 action = 10 minutes) and call the result estimated hours until real hours exist. (Avoid: Counting every log event, including the platform's automatic ones.)
6. **Volume is not productivity.** The number of tasks, messages and actions measures operational energy, not results, and logged hours are not capacity. Read volume next to the client's results (leads, cost per result) and pressure signals (stalled tasks, tasks with no owner). Never rank people by count alone. (Avoid: Rewarding the media buyer with the most account changes.)
7. **The client key is the tax document.** In finance, the client appears under the legal name, which often contains none of its brands. Match revenue and cost on CNPJ (company tax ID), or CPF (individual tax ID) for individual clients. When a source only has a name, normalize it (lowercase, no accents, letters and digits only) and keep an alias table. Deliverables with no identified client go on their own flagged row and never mix with a real client. (Avoid: Matching the job system's client to finance by name.)
8. **Full join and null margin when one side is missing.** Use a full join between cost and revenue by client and accrual month. When revenue is missing in a month, the margin is not the negative cost; when deliverables are missing, it is not the whole revenue: the monthly margin is null, with the missing side written down. Because the deliverable lands in one month and the invoice in the next, the client ranking uses the margin summed over the whole window, not the monthly one. (Avoid: Inner join between cost and revenue and a ranking by one month's margin.)
9. **Activity type by a fixed rule.** Classify each time entry by the department of whoever logged it (creative, media, content, planning, production) and the free-text description by rules: client meeting, internal meeting, changes and jobs. Rework requested by the client and internal rework are different codes and are not added together as one thing. (Avoid: Reading the free-text description case by case, every report.)
10. **Margin per client is confidential.** The margin table exposes how much each relationship earns and which ones lose money. It never goes to the client portal or into the context of an agent that serves clients. Named payroll enters aggregated by month, so no employee data reaches the table. (Avoid: Publishing margin on the same dashboard the client opens.)

### How to measure effort, best to worst

Use the best measure the data supports and declare which one was used.

- **Logged hours with high coverage** → Real hours
- **Monthly cost allocated across deliverables, with complexity weight** → Allocated cost
- **Human actions in the ad accounts' log** → Estimated hours (`1 action = 10 min`)
- **Open, stalled and ownerless tasks in the task manager** → Operational pressure
- **WhatsApp message count** → Do not use on its own

### Definitions

| Metric | Definition |
|---|---|
| Agency revenue | retainer + media commission + the client's other own revenue in the accrual month, without on-behalf billing and without pass-through |
| Monthly operating cost | sum of expenses classified as operating in the accrual month, without pass-through media and without partner draws |
| Cost allocated to the client | sum of the allocated cost of the client's deliverables in the accrual month, in a closed month |
| Client margin | agency revenue - allocated cost, null when either side is missing |
| Window margin | sum of revenue - sum of allocated cost for the client across all closed months in the window |
| Margin without media commission | client margin - media commission; measures dependence, it is not the margin |
| Estimated hours | human actions in the ad accounts x declared factor (e.g. 10 minutes), by client and week |
| Revenue per estimated hour | client MRR / estimated hours in the same period |
| Coverage | deliverables or accounts with the effort measure / total deliverables or accounts in the period |

### Pitfalls

- **Two margins with opposite signs.** Without knowing whether media inflow was gross or commission, the first version published one positive and one negative margin and left the choice to the reader. The finance subcategory itself said it was commission. How to avoid: Prove the nature of media revenue in the data before computing margin.
- **Margin exploding in the current month.** The deliverables data ran up to the current month, but expenses were only posted up to months earlier. Recent margin looked extremely high. How to avoid: Cost only for closed months, detected by the number of entries.
- **More than half the rows disappeared.** Cost and revenue by client and month were joined with an inner join. Only part of the pairs had both sides, and the rest vanished without warning. How to avoid: Full join, with the missing side flagged.
- **The match failing on almost every row.** Media came with one client name and effort with another. Before normalization and the alias table, almost no rows matched. How to avoid: Normalize names and keep an alias table until a shared client id exists.
- **Client with no deliverables at 100% margin.** Clients billed without any deliverable in the job system got zero cost and appeared at the top of the ranking. How to avoid: Null cost, not zero, when no deliverable is recorded.
- **Automatic actions counted as work.** The accounts' activity log mixes actions by people with changes made by the platform itself, such as delivery started and billing. How to avoid: Count only actions whose author is not the platform.

Validated on real data: In the activity log of one of Nekt's own Meta Ads accounts, 47 of 173 events (27%) had Meta itself as the author: automatic status changes, first delivery and billing. Counting them all as the media buyer's effort would inflate effort by more than a third.

### Acceptance test

- [ ] In each closed month, the cost allocated to all clients (plus the no-document row) equals the month's operating cost (zero difference).
- [ ] The table has one row per client and accrual month, with no repeats.
- [ ] No row has a computed margin when revenue or cost is missing.
- [ ] A client's estimated hours for the week match the count of human actions in the log times the declared factor.
- [ ] No on-behalf billing enters agency revenue.

### Context document

```text
Profitability per client (internal use, never for clients)
- Agency revenue = retainer + media commission + own revenue. On-behalf billing and pass-through budget are neither revenue nor cost.
- The client's cost is allocated: the month's real operating cost spread across the month's deliverables, weighted by list price when it exists. It is an allocation, not a measurement.
- A month without complete expenses has no cost and no margin. Do not estimate.
- Margin is null when revenue or cost is missing. For client rankings, use window margin.
- Partner draws are not cost.
- Effort without timesheets: human actions in the accounts' log (author other than the platform) x 10 minutes = estimated hours. Always say it is an estimate and report coverage.
- Task or message volume is not productivity.
- The client is the CNPJ. Do not join by name.
Client exceptions:
- <client>: group with CNPJs <list>, summed only on read.
- <client>: retainer includes management of a <value> budget; the budget is pass-through.
```

### Variations

- **Effort per media buyer:** Human actions per person and week, split into creation, status and budget, read alongside the accounts' results.
- **Timesheet hours:** When time entries are reliable, hours by client, job and department, with meetings, changes and rework separated.
- **Revenue vs. contracted deliverables:** Fee per completed deliverable, using only the fee in the numerator, never the pass-through.
