Table.Distinct
TableRemoves duplicate rows from a table based on all columns or specified criteria.
Syntax
Table.Distinct(table as table, optional equationCriteria as any) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The table to remove duplicate rows from. |
equationCriteria | any | No | A column name, list of column names, or comparer function used to determine which columns to check for duplicates. If omitted, all columns are compared. |
Return Value
table — A table with duplicate rows removed.
Remarks
Table.Distinct removes duplicate rows from a table. Without equationCriteria, rows must match on every column to be considered duplicates. Pass a column name or list of column names to deduplicate based on specific columns only — the first occurrence of each unique value is kept.
Table.Distinct is similar to Table.RemoveDuplicates. The key difference is that Table.Distinct supports comparer functions in its criteria (e.g., Comparer.OrdinalIgnoreCase for case-insensitive matching), while Table.RemoveDuplicates takes a simple list of column names.
Examples
Example 1: Get distinct categories
Table.Distinct(Table.SelectColumns(Sales, {"Category"}))Result
Category | |
|---|---|
| 1 | Widgets |
| 2 | Gadgets |
| 3 | Misc |
Example 2: Distinct customers by name
Table.SelectColumns(Table.Distinct(Sales, "CustomerName"), {"CustomerName", "Product", "Region"})Result
CustomerName | Product | Region | |
|---|---|---|---|
| 1 | Alice | Widget A | East |
| 2 | Bob | Gadget B | West |
| 3 | Charlie | Widget C | East |
| 4 | Diana | Widget A | West |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks