Breyta

Deila með


COLUMNSTATISTICS

Applies to: Calculated column Calculated table Measure Visual calculation

Note

This function is discouraged for use in visual calculations as it likely returns meaningless results.

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.

  • For binary-typed columns, the Min and Max statistics will have BLANK values.

Example

Examples in this article can be used with the sample Adventure Works DW 2020 Power BI Desktop model. To get the model, see 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.

COLUMNSTATISTICS result table

Filter context
CALCULATETABLE function