Value.Equals
true when two values match, by the same rules as the = operator.
Group: Values, types and errors. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Value.Equals(value1 as any, value2 as any, optional precision as nullable number) as logical
| Parameter | Type | Description |
|---|---|---|
value1 | any | The first value. |
value2 | any | The second value. |
precision | nullable number optional | Precision.Double (the default) or Precision.Decimal. |
Returns
logical. true when the values are equal.
Remarks
- Lists are equal item by item, records field by field whatever the fields' order, tables row by row.
- Values of different kinds are never equal: a date is not the datetime at its midnight.
- Numbers are compared as they are stored: 0.1 + 0.2 is not quite 0.3. With
Precision.Decimalboth are taken as the decimals Power Query shows for them (15 significant digits) and then compared; rounding both first works too. - null equals null here;
Value.NullableEqualsanswers null when either value is null.
Examples
Records with their fields in another order
Value.Equals([Product = "Chair", Price = 50], [Price = 50, Product = "Chair"])
true
Computed decimals
Value.Equals(0.1 + 0.2, 0.3)
false
Compared as decimals
Value.Equals(0.1 + 0.2, 0.3, Precision.Decimal)
true
Related functions
Value.Compare, Value.NullableEquals, Comparer.Equals, List.Contains.