# REBOOK
URL: https://docs.valsight.ai/rebook/
Description: The REBOOK function moves value measures from one level value to another within the same level, setting source values to zero and adding amounts to the target value.
**Category:** [Dimensionality & hierarchies](/dimensionality-hierarchies/)

## Overview

The **REBOOK** function **moves value measures from one level value to another within the same level**. The source values are set to zero and their amounts are added to the target value. An optional filter operation controls which level values are rebooked.

Use this function when you need to reclassify values from one level value to another within the same level.

## Syntax

`REBOOK('Node', "Level", "OldValue", "NewValue" [, "FilterOperation"])`

**Example usage:** `REBOOK('Revenue', "Segment", "MINI", "LARGE")`

## Parameters

| Parameter           | Description                                                               | Type                | Required | Default        |
| ------------------- | ------------------------------------------------------------------------- | ------------------- | -------- | -------------- |
| **Node**            | Input node                                                                | Node reference      | Yes      | --             |
| **Level**           | The level in the input node whose values should be rebooked               | Level name          | Yes      | --             |
| **OldValue**        | The source value(s) to rebook. Can be a single value or a list of values. | Level value or list | Yes      | --             |
| **NewValue**        | The target value to rebook into. Must be a single value.                  | Level value         | Yes      | --             |
| **FilterOperation** | Controls which level values match the OldValue for rebooking              | Keyword             | No       | `"EQ"` (equal) |

**FilterOperation options:**

* `"EQ"`: Rebooks the measures of the level value(s) **equal** to OldValue. This is the **default**.
* `"NEQ"`: Rebooks all measures of level values **not equal** to OldValue.
* `"GT"`: Rebooks all measures of level values **greater than** OldValue (lexicographic order).
* `"GTE"`: Rebooks all measures of level values **greater than or equal to** OldValue.
* `"LT"`: Rebooks all measures of level values **less than** OldValue.
* `"LTE"`: Rebooks all measures of level values **less than or equal to** OldValue.

The comparison operators (GT, GTE, LT, LTE) use **lexicographic (alphabetical) order**. "Greater" means the level value starts with a letter that comes after the first letter of OldValue alphabetically.

**See also:** [Comparisons & boolean operators](/comparisons-boolean-operators/)

## Output shape

| Aspect         | Behavior                                                                                                                                        |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Dimensionality | Same as input.                                                                                                                                  |
| Level values   | Same as input. Source values remain in the output with value **0**. Target value receives the rebooked amounts **added** to any existing value. |
| Row count      | Same as input.                                                                                                                                  |

## Watch out

* OldValue and NewValue must be **level values of the same level** specified in the formula.
* REBOOK only works on the **lowest level** of a dimension. If you specify a higher level, the function fails.
* If the node contains **linked levels**, you cannot rebook values of the linked-to dimension directly. Rebook via the initial dimension that the other dimension is linked to. REBOOK always keeps linked levels between dimensions.
* **Do not use** this function if you want the node to have different linked levels than the initial dimension.

## Examples

These examples show how values are moved from one segment to another within the same level, including list-based rebooking and filtered rebooking.

**Input node:** `'Revenue'`

| Year | Segment | Value |
| ---- | ------- | ----- |
| 2025 | MINI    | 100   |
| 2025 | COMPACT | 50    |
| 2025 | LARGE   | 10    |

### Rebook a single value

This example moves the value of one segment into another existing segment.

**Formula:** `REBOOK('Revenue', "Segment", "MINI", "LARGE")`

| Year | Segment | Calculation | Result |
| ---- | ------- | ----------- | ------ |
| 2025 | MINI    | 100 - 100   | 0      |
| 2025 | COMPACT | N/A         | 50     |
| 2025 | LARGE   | 10 + 100    | 110    |

The value measure of MINI (100) is moved to LARGE. Since LARGE already had a value of 10, the rebooked amount is added (10 + 100 = 110).

### Rebook a list of values

This example rebooks a list of source values into one target value.

**Formula:** `REBOOK('Revenue', "Segment", ["MINI", "COMPACT"], "LARGE")`

| Year | Segment | Calculation   | Result |
| ---- | ------- | ------------- | ------ |
| 2025 | MINI    | 100 - 100     | 0      |
| 2025 | COMPACT | 50 - 50       | 0      |
| 2025 | LARGE   | 10 + 100 + 50 | 160    |

Both MINI and COMPACT are rebooked to LARGE. Their combined value (150) is added to LARGE's existing value (10).

### Rebook with a filter operation

This example uses the NEQ filter to rebook all values that do **not** match the source value.

**Formula:** `REBOOK('Revenue', "Segment", "MINI", "LARGE", "NEQ")`

| Year | Segment | Calculation | Result |
| ---- | ------- | ----------- | ------ |
| 2025 | MINI    | N/A         | 100    |
| 2025 | COMPACT | 50 - 50     | 0      |
| 2025 | LARGE   | 10 + 50     | 60     |

With NEQ, all segments **not equal** to MINI are rebooked to LARGE. So COMPACT's value (50) is moved to LARGE, while MINI is untouched.

## Related

| Function                       | When to use instead                                                                                                      |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| [DISTRIBUTE](/distribute/)     | When values should be split across multiple level values using weights instead of moved from one level value to another. |
| [REDISTRIBUTE](/redistribute/) | When values should be redistributed within defined clusters rather than rebooked directly between level values.          |
