Comparer Functions Overview

Updated on

Comparer values are used to test whether values are the same and determine the ordering of values. That can be useful for different operations. For instance:

  • Providing information: When checking if a text contains a specific substring, you might need to respect a particular culture’s rules or ignore capitalization in your comparison.
  • Returning Values: Comparer Functions are crucial for operations like removing duplicates, finding common values, or determining the middle value (mode) of a list of values. The way you compare each value directly impacts these outcomes.
  • Sorting Values: Sorting requires certain comparison rules. You can use the built-in comparers or create your own custom comparer logic to define how values should be sorted.
  • Grouping Values: Influencing what defines a group during grouping operations is another use of comparer values. By customizing the rules for comparisons you can refine how groups are determined.

To explore comparer functions, have a look at the table below, which lists and describes the Comparer Functions available in the M Language.

Comparer Functions

FunctionDescription
Comparer.EqualsReturns a logical value based on the equality check over the two given values.
Comparer.FromCultureReturns a comparer function given the culture and a logical value for case sensitivity for the comparison.
Comparer.OrdinalReturns a comparer function which uses Ordinal rules to compare values.
Comparer.OrdinalIgnoreCaseReturns a case-insensitive comparer function which uses Ordinal rules to compare values.

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/comparer-functions

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy