# Cost allocations

> Share a cost such as rent across classes, locations or the entities of a group with a rule: fixed percentages, revenue share, the balance of an account or headcount. Preview the basis and the lines, post once per period, keep the basis each run read, and reverse a run with a reason.

Source: /help/en/accounting/cost-allocations

An allocation shares a cost that was booked in one place across the parts of the business that used it: the rent across three branches, the internet bill across classes, the group's utilities across two companies. In Alya Books an allocation is a **rule** you write once and a **run** per month or quarter that posts one entry.

Across classes or locations, the entry is a **reclass inside the account**. It debits the account once per class or location for its share and credits the same account for the whole amount. The account's total does not change; what changes is how much of it each class or location carries. So the trial balance and the income statement of the whole organisation read as before, and the statements **by class or by location** read the shares.

## Before you start

- **Settings → Accounting → Modules → Cost allocations** must be **Enabled**. The module is in the Enterprise plan; on another plan the Modules card says "In Enterprise".
- The classes or locations you allocate to exist under **Settings → Accounting → Dimensions and locations** (see [Dimensions and locations](/help/en/accounting/dimensions-and-locations)).
- Allocating across companies needs an entity group (see [Across the entities of a group](#across-the-entities-of-a-group)).

## A worked example: rent across three locations by revenue share

Golden Trading has three locations: Dubai (the primary one), Abu Dhabi and Sharjah. In March they sold 50,000, 30,000 and 20,000. The month's rent of 10,000 was entered as one bill on account `6100` Rent; like every bill entered while locations are switched on, it took the primary location, so the whole 10,000 sits on Dubai.

1. **Cost allocations** in the sidebar (`/allocations`) → **New rule**.
2. **Name** `Rent by revenue share`; **Source accounts** `6100`; **Only the lines of** *Location*, then *Dubai* (where the cost sits today); **Share across** *Location*; **Basis** *Revenue share*; **Frequency** *Monthly*. **Save**.
3. In the rule's row menu choose **Run this period**, set **Period** to any day of March and choose **Preview**. Nothing is posted yet.
4. Read **Basis per target**: Dubai 50,000 (50 %), Abu Dhabi 30,000 (30 %), Sharjah 20,000 (20 %), 100,000 in total. These are the sales each location carries in the ledger for March.
5. Read **Lines**:

| Account | Target | Debit | Credit |
|---|---|---|---|
| 6100 Rent | Dubai | 5,000.00 | |
| 6100 Rent | Abu Dhabi | 3,000.00 | |
| 6100 Rent | Sharjah | 2,000.00 | |
| 6100 Rent | Dubai (the source) | | 10,000.00 |

6. **Confirm**. One entry dated 31 March is posted, and the run appears on the **Runs** tab as **Posted** with its entry number.
7. Check the result: account `6100` still totals 10,000.00. By location it now reads Dubai 5,000.00, Abu Dhabi 3,000.00 and Sharjah 2,000.00.
8. Choose **Run this period** for March again: the preview says the rule is already posted for the period and nothing changes. A rule runs once per period, however often you or the monthly run ask.

If the rent line had been entered with **Location** set to *None*, you would leave **Only the lines of** on *Every line*: the credit of 10,000.00 then carries no location, and the three debits are the same.

## The four bases

The basis decides each target's share. The preview always shows the figure it read per target and the percentage that follows.

| Basis | What it reads | Use it when |
|---|---|---|
| **Fixed percentages** | The percentages you type on the rule, one per target. They must add up to 100 | The split is agreed and does not move: 50 / 30 / 20 by floor area |
| **Revenue share** | The income each target carries in the ledger over the period (the income accounts' lines tagged with that class, location or entity) | A cost should follow sales, such as rent, marketing or head-office charges |
| **Balance of an account** | One account's figure per target: its movement over the period for an income or expense account, its balance on the period end for any other account | A cost should follow another figure, such as the internet bill by each branch's software spend, or insurance by each location's fixed assets |
| **Headcount** | A number you type per target on the rule (people, desks, square metres). The shares are each number over their total | The driver is not in the ledger |

- The last target takes the rounding difference, so the debits always equal the credit. 1,000 over 3, 3 and 1 people posts 428.57, 428.57 and 142.86.
- With revenue share and balance of an account, a target that carries nothing in the period gets no line.
- Change the headcount or the fixed percentages on the rule when they change. Past runs keep the figures they read.

## The source: what is allocated

- A rule names its **Source accounts** (one or several), a **Source account group** (every account of the group that carries something to allocate), or both.
- The amount is the period's movement on the source accounts **that is not yet on a target**. A rule across classes takes the lines without a class; a rule across locations takes the lines without a location. A line that already names a class or location is left where it is.
- **Only the lines of** (the source filter) narrows the source to one class, department or location. For example, only the lines of the department *Head office* are spread across the locations; the rest of the account stays.

> While **Use business locations** is switched on, a bill, an expense or a journal line entered without a location takes the **primary location**. A cost entered the usual way therefore sits on the primary location, a rule across locations finds no line without a location, and the preview says there is nothing to allocate. Set **Only the lines of** on the rule to that location: the run takes the cost out of the primary location and gives it back only its own share, as in the worked example.

## A run keeps the basis it read

Each run stores the basis table it posted from. A sale entered later in a month that has already been allocated does **not** move the posted run: the entry and its figures stay.

To refresh a period after late entries, **reverse** its run and run the period again. The new run reads the ledger as it stands now. In the worked example, a late Sharjah sale of 25,000 changes nothing until you reverse; the second run then shares the rent over 50,000, 30,000 and 45,000 and posts 4,000.00, 2,400.00 and 3,600.00.

Changing a rule works the same way: it applies from the next run and never rewrites a posted one.

## Reversing a run

1. **Cost allocations** → the **Runs** tab → **Reverse** on the posted run.
2. Type the **Reason**. It is required and is kept on the run.
3. **Reverse**. A reversal entry is posted, the run reads **Reversed**, and the period can be run again.

- A rule that has run even once cannot be deleted: its runs are part of the ledger's history. **Switch off** the rule instead (its row menu); it moves under the **Inactive** chip and every run skips it. A rule that never posted can be deleted.
- Reversing in a locked period is refused like every posting in it: open the period first, or send the change for approval when the page offers it.

## Across the entities of a group

A rule can allocate across **entities** (the companies of an entity group) by **fixed percentages** or **revenue share**. The reclass cannot stay inside one account here, because the cost moves from one company's books to another's. For each receiving entity the run posts an **intercompany pair**:

- In the entity that paid, the cost account goes **down** by the other entity's share, against *Due from* that entity.
- In the receiving entity, the account **with the same code** goes **up** by the same amount, against *Due to* the paying entity.

The entity that owns the rule keeps its own share, so it gets no line. Example: 4,000 of `6110` Utilities shared 60 / 40 leaves 2,400.00 in the entity that paid, puts 1,600.00 on `6110` of the other, and due from and due to both read 1,600.00. Reversing the run reverses both sides.

This needs the entities feature with both companies in one group, and the same account code in both charts. See [Entities, intercompany and consolidation](/help/en/accounting/entities-intercompany-and-consolidation).

## The monthly run

- **Run this period** above the list runs every active rule that is due, with one preview for all of them; the one in a rule's row menu runs that rule alone.
- On the **first of each month**, Alya Books runs every active rule for the month that has just ended. You do nothing; the runs appear on the **Runs** tab as **Posted**.
- A **quarterly** rule covers the calendar quarter and runs in the quarter's last month: after March, June, September and December.
- A rule with nothing to allocate or an empty basis is skipped for that period; run it yourself once the figures are there.
- **A locked period.** If the month is already locked, nothing is posted. The run is held on the **Runs** tab as **Held** with the reason. When the period is open again, **Run this period** posts the held run; or **Withdraw** it if it is no longer wanted (a held run posted nothing, so no reason is asked).
- Over the API, a run or a reversal dated in a locked period becomes a **proposal** for an approver, like every other write.

## Who can do what

| | Owner, admin | Accountant | Approver, viewer |
|---|---|---|---|
| See rules, runs and the preview | Yes | Yes | Yes |
| Create, change, switch off or delete a rule (the *accounting settings* right) | Yes | Yes | No |
| Run a period, reverse or withdraw a run (the *posting* right) | Yes | Yes | No |

These are the standard rights of each role. A firm that changed its role matrix sees its own (see [Client groups, teams and the role matrix](/help/en/firm/client-groups-and-access)).

## Through the API and an AI assistant

Integrations use `/allocation-rules` (list, create, change, delete), `POST /allocations/preview`, `POST /allocations/run` (with `X-Preview: true` nothing is written), `GET /allocation-runs` and `POST /allocation-runs/{id}/reverse`.

The MCP tools are `list_allocation_rules`, `save_allocation_rule`, `preview_allocation`, `run_allocations`, `reverse_allocation_run` and `list_allocation_runs`. An assistant shows the preview and asks before it runs or reverses anything. See docs.alyabooks.ai.

## Troubleshooting

| What you see | Why | What to do |
|---|---|---|
| "The source accounts carry nothing to allocate in this period." | The source accounts carry no amount in the period that is not already on a target. Either there is no cost in the period, or it sits on a location or class | Check the account for the period. If the cost sits on the primary location, set **Only the lines of** to it (see the note above) |
| `allocation_basis_empty` | No target carries a figure for the basis: no location sold anything in the period, the basis account is empty, or every headcount is zero | Post the period's sales first, pick another basis, or type the shares |
| `allocation_already_posted` | You tried to delete a rule that has posted or reversed runs | **Switch off** the rule instead |
| "This rule is already posted for the period." | The rule already ran for this period | Nothing to do. To refresh the period, reverse the run and run again |
| `allocation_run_not_found` | The run is not posted: it was already reversed, or withdrawn | Reload the **Runs** tab and check the run's status |
| `module_not_enabled` | The module is off, or the plan does not carry it | Enable **Cost allocations** under Settings → Accounting → Modules (Enterprise) |
