> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Which limit applies when scopes overlap?

> The tie-break order Atoti Limits uses when several limits overlap for the same coordinate, covering precedence, explicit versus wildcard matches, 'selected' versus 'excluding selected' scope types, `TEMPORARY` versus `OFFICIAL` limit type, and goal value

Several limits can be technically valid for the same coordinate in the cube. For example, one limit might use a wildcard scope while another uses an explicit member. When this happens, Atoti Limits selects exactly one limit to evaluate, using a deterministic, ordered set of tie-break rules. This page describes that order.

## What is the tie-break order between overlapping limits?

Atoti Limits compares two overlapping limits using the checks below, in order. The comparison stops at the first check that finds a difference. Each later check only applies when every earlier check is tied.

1. **Higher precedence.** The limit with the higher precedence value wins.
2. **Explicit match over wildcard match.** A limit that matches the coordinate through an explicit member wins over a limit that matches through a wildcard. For example, a limit scoped to `Book = A` wins over a limit scoped to `Book = *`. Both apply at the coordinate `Book A`.
3. **Depends on which side of check 2 the comparison landed on.** These are two mutually exclusive branches. A single comparison between two limits only ever takes one of them, never both:
   * **If both limits matched explicitly:** a limit whose scope uses only "selected" types ("(For each) selected" or "(Total) of selected") wins over a limit that uses an "excluding selected" type ("(For each) excluding selected" or "(Total) excluding selected"). See [Advanced scopes](https://docs.activeviam.com/atoti-intelligence/workflows/limits/6.2/dev/configure/scopes/advanced-scopes.md) for the scope types.
   * **If both limits matched only through a wildcard:** the limit with more wildcard matches wins.
4. **Limit type.** A `TEMPORARY` limit wins over an `OFFICIAL` limit.
5. **The most conservative goal value.** For a KPI evaluated as "greater than", the lower limit goal wins, because it is more restrictive. For a KPI evaluated as "less than", the higher limit goal wins.

## Why does a "selected" limit win over an "excluding selected" limit?

A "(For each) selected" limit and a "(For each) excluding selected" limit can both be explicit matches for the same member. For example, consider two limits on the `Book` level, both valid for the coordinate `Book = Book 1`:

* `Book = [ Book 1 + Book 2 ]` ("(For each) selected"), goal 2000.
* `Book <> [ Book 3 + Book 4 ]` ("(For each) excluding selected"), goal 1000.

Both limits match `Book 1` explicitly. The first limit matches because `Book 1` is one of its listed members. The second limit matches because `Book 1` is not one of its excluded members. Checks 1 and 2 end in a tie. Neither limit has a higher precedence, and both matches are explicit.

Because both limits matched explicitly, check 3 takes its "selected" versus "excluding selected" branch, not its wildcard-match-count branch. The wildcard-match-count branch never applies here, since neither limit matched through a wildcard. The first limit uses "(For each) selected", so it wins over the second limit, which uses "(For each) excluding selected". Without check 3, both limits would stay tied through check 4 too, assuming the same limit type. The comparison would then fall to check 5, the goal value. That check would pick the "excluding selected" limit's lower, more conservative goal instead.

## Why does a wildcard-scoped limit come last?

A wildcard match, such as `Book = *`, is the least specific kind of match a scope can produce. Check 2 already ranks every explicit match ahead of every wildcard match. Because of this, the wildcard-match branch of check 3 is never even reached when comparing an explicit match against anything: check 2 already resolved that comparison.

The wildcard-match branch of check 3 only runs when comparing two limits that both lack an explicit match at the current level, and it decides between them by counting wildcard matches. In practice, a wildcard-scoped limit is chosen only when no explicit match applies. This must hold for the same coordinate at the same or higher precedence.
