<!-- https://learnsql.cpetoday.com/functions/m/table-profile -->
# Table.Profile

Language: Power Query M
Category: Table: headers and shape
Syntax: Table.Profile(table as table, optional additionalAggregates as nullable list) as table
Summary: Returns a table of statistics about each column, such as counts of blank and distinct values.
Returns: A table with one row for each column of the input.
Level: Intermediate
Related: Table.Schema, Table.RowCount, Table.Distinct, Table.Group

## What it does
Table.Profile gives a quick statistical summary of each column. It shows how many values are blank, how many are different from each other, and the minimum and maximum where they make sense. Use it to check a new export before you rely on it. It is a checking tool, so keep it in a separate query and not in the report.

## Syntax and arguments
- **table**: the table to profile. Required.
- **additionalAggregates**: an optional list of extra statistics to calculate. Leave it out for the standard summary.

## Example
Before a new bank export is loaded into the monthly report, the file is profiled in a separate query. The preparer opens it to see which columns are mostly blank.

```powerquery
let
    Source = Excel.CurrentWorkbook(){[Name = "Bank"]}[Content],
    Quality = Table.Profile(Source)
in
    Quality
```

Load this query to a worksheet or leave it as a connection-only query while checking the file. The report query is not changed.

## Example: a second, different use
A receivables export is profiled to see how many distinct customers appear, which helps check that customer names are consistent.

```powerquery
let
    Source = Excel.CurrentWorkbook(){[Name = "ARExport"]}[Content],
    Profiled = Table.Profile(Source)
in
    Profiled
```

## Things to watch
- Profiling reads the whole table, which is slow on large sources. Use it on a sample while you check, not on every refresh.
- The output is for people to read. Do not build the report from it.
- Read the result as a sign of what to check, not as proof. A blank count tells you where to look, and the source still has to be reviewed.
- Query folding: this step breaks folding, because the statistics are calculated by Power Query.

## In business terms
Before a reconciliation or a model is built on an export, a profile shows the blanks, the duplicates and the odd values. It is a quick data quality check that the reviewer can point to.
