OpenBI Docs Buy

COLUMNSTATISTICS

A row for every column of every table: its least and greatest value, its number of distinct values and its longest text.

Group: Table manipulation. Compatible with DAX.

Syntax

COLUMNSTATISTICS ( )

It takes no parameters.

Returns

Table. A row for each column of the model's tables, giving Table Name, Column Name, Min, Max, Cardinality and Max Length.

Remarks

  • Min and Max are the least and the greatest value, blanks left out. Cardinality is the number of different values, a blank counting as one. Max Length is the length of the longest text, blank for other types.
  • Each table starts with a row for its hidden row-number column, whose Cardinality is the table's number of rows.
  • It always describes the whole model: filters do not narrow it. Use it right after EVALUATE; Power BI refuses it where a filter is in force, for example inside CALCULATETABLE.
  • Under row-level security a user's figures cover the rows they may see, and tables or columns hidden from them are left out.
  • It is a tool for getting to know a model in a query, not for a report.

Examples

The columns of one table

Two holdings have no price: the Price column holds three prices and a blank, four values.

EVALUATE
SELECTCOLUMNS (
    FILTER ( COLUMNSTATISTICS (), [Table Name] = "Holdings" ),
    "Column", [Column Name],
    "Least", [Min],
    "Greatest", [Max],
    "Values", [Cardinality],
    "Longest text", [Max Length]
)
ORDER BY [Column]
ColumnLeastGreatestValuesLongest text
BondCorporate 2030Municipal 2031515
Coupon0.02250.04755(blank)
Maturity2028-03-022033-03-155(blank)
Nominal800000003000000005(blank)
Price92.15101.34(blank)
RowNumber-2662979B-1795-4F74-8F37-6A1BA8059B61(blank)(blank)5(blank)

How many rows each table has

The row-number column's cardinality is the table's row count.

EVALUATE
SELECTCOLUMNS (
    FILTER ( COLUMNSTATISTICS (), LEFT ( [Column Name], 10 ) = "RowNumber-" ),
    "Table", [Table Name],
    "Rows", [Cardinality]
)
ORDER BY [Table]
TableRows
Accounts28
Brewing23
Companies8
Countries176
Demand4
Distances240
Holdings5
Ledger4941
Periods36
Places16
Plants3
Prices1542
Production12
Products4
Rates8
Sales2160
Suppliers15

COUNTROWS, DISTINCTCOUNT, MIN, MAX, LEN.

Last updated · OpenBI Studio 0.3.74