Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 2.12 KB

columnstatistics-function-dax.md

File metadata and controls

66 lines (43 loc) · 2.12 KB
description title
Learn more about: COLUMNSTATISTICS
COLUMNSTATISTICS function (DAX) | Microsoft Docs

COLUMNSTATISTICS

[!INCLUDEapplies-to-measures-columns-tables-visual-calculations-discouraged]

Returns a table of statistics regarding every column in every table in the model.

Syntax

COLUMNSTATISTICS ()

Parameters

This function does not take any parameters.

Return value

A table of statistics. Each row of this table represents a different column in the model. Table columns include:

  • Table Name: The current column’s table.
  • Column Name: The current column’s name.
  • Min: The minimum value found within the current column.
  • Max: The maximum value found within the current column.
  • Cardinality: The number of distinct values found within the current column.
  • Max Length: The length of the longest string found within the current column (only applicable for string columns).

Remarks

  • Columns in an error state and columns from query-scope calculated tables do not appear in the result table.

  • If a filter from the filter context is applied to COLUMNSTATISTICS(), an error is returned.

Example

[!INCLUDE power-bi-dax-sample-model]

The following DAX query:

DEFINE
    TABLE FilteredProduct =
        FILTER (
            Product,
            [Color] == "Blue"
        )
    COLUMN Customer[Location] = [State-Province] & " " & [Country-Region]

EVALUATE
COLUMNSTATISTICS ()

Returns a table with statistics regarding all columns from all tables in the model. The table also includes statistics for the query-scope calculated column, Customer[Location]. However, the table does not include the columns from the query-scope calculated table, FilteredProduct.

:::image type="content" source="media/columnstatistics-function-dax/columnstatistics-result-table.png" alt-text="COLUMNSTATISTICS result table":::

Related content

Filter context
CALCULATETABLE function