---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - >-
    en/troubleshooting/errors/ERR-DS_API-INVALID_QUERY_STRUCTURE-INCONSISTENT_AGGREGATION
  - >-
    ru/troubleshooting/errors/ERR-DS_API-INVALID_QUERY_STRUCTURE-INCONSISTENT_AGGREGATION
  - href: >-
      en/troubleshooting/errors/ERR-DS_API-INVALID_QUERY_STRUCTURE-INCONSISTENT_AGGREGATION.md
    type: text/markdown
    title: Markdown version
csp:
  - script-src:
      - https://mc.yandex.ru
    img-src:
      - https://mc.yandex.ru
    connect-src:
      - https://mc.yandex.ru
      - wss://mc.yandex.ru
    child-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-ancestors:
      - 'blob:'
      - https://mc.yandex.ru
canonical: >-
  en/troubleshooting/errors/ERR-DS_API-INVALID_QUERY_STRUCTURE-INCONSISTENT_AGGREGATION.html
title: >-
  DataLens On-premises error
  ERR.DS_API.INVALID_QUERY_STRUCTURE.INCONSISTENT_AGGREGATION
description: >-
  This page describes the Inconsistent aggregation status among SELECT items
  DataLens On-premises error.
vcsPath: >-
  en/troubleshooting/errors/ERR-DS_API-INVALID_QUERY_STRUCTURE-INCONSISTENT_AGGREGATION.md
---

# [DataLens On-premises] Inconsistent aggregation status among SELECT items

`ERR.DS_API.INVALID_QUERY_STRUCTURE.INCONSISTENT_AGGREGATION`

This error occurs when an expression combines data with different [levels of detail (LOD)](../..//function-ref/aggregation-functions.md#syntax-lod).

When computing an aggregate value, a large set of strings is converted into a single value. Special [aggregate functions](../..//function-ref/aggregation-functions.md) are used for this. The most common functions are `SUM`, `MIN`, `MAX`, `AVG`, and `COUNT`. The aggregate functions calculate and return one resulting value for all strings of the query. If data grouping is used, values are calculated and returned separately for each one of the groups the query result is broken down into.

In DataLens, you can use LOD expressions to create nested aggregations as well as aggregations over all data or groups that are different from the chart-level grouping. However, you cannot use data with different LODs in one expression.

To resolve the error, make sure all data in an expression has the same level of detail.
