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

# default_group_by - Model files

> Controls whether measure-less queries get an implicit GROUP BY.

<Note>
  This parameter is distinct from the query view-level [`default_group_by`](/modeling/query-views/parameters/default-group-by) parameter. The two settings apply at different scopes and serve different purposes.
</Note>

Controls whether measure-less queries get an implicit `GROUP BY`.

`always_having`, totals, and pivots will continue to force aggregation regardless of this setting.

## Syntax

```yaml theme={null}
default_group_by: <always | never | primary_key>
```

## Properties

<ParamField path="default_group_by" type="string" default="always">
  Controls whether measure-less queries get an implicit `GROUP BY`. Valid values are:

  * `always` — **Default**. Measure-less queries always get an implicit `GROUP BY`.
  * `never` — Measure-less queries never get an implicit `GROUP BY`
  * `primary_key` — The implicit `GROUP BY` is dropped only when the full primary key is selected unparameterized and there is no fan-out join. This avoids unnecessary deduplication when the result set is already guaranteed to be unique.

  <Note>
    `always_having`, totals, and pivots will continue to force aggregation regardless of this setting.
  </Note>
</ParamField>

## Examples

### Always group

In this example, measure-less queries always include a `GROUP BY`, deduplicating rows where all selected dimensions have identical values.

```yaml theme={null}
default_group_by: always
```

### Never group

In this example, measure-less queries will not include an implicit `GROUP BY` and will potentially return duplicate rows.

```yaml theme={null}
default_group_by: never
```

### Group by primary key

In this example, the implicit `GROUP BY` is only dropped when the full primary key is selected unparameterized and there is no fan-out join. This avoids unnecessary deduplication when the result set is already guaranteed to be unique.

```yaml theme={null}
default_group_by: primary_key
```
