Comparer.Ordinal
ComparerA case-sensitive ordinal comparer function.
Syntax
Comparer.Ordinal as functionReturn Value
function — A comparer function that performs case-sensitive ordinal (byte-level) comparisons.
Remarks
Comparer.Ordinal is a built-in comparer function that performs case-sensitive, byte-level comparisons. It does not account for linguistic or cultural sorting rules — uppercase letters sort before lowercase letters (e.g., "B" comes before "a" in ordinal order).
Use Comparer.Ordinal as an argument to functions like List.Sort, List.Distinct, Table.Distinct, and Table.Sort when you need strict case-sensitive behavior.
Examples
Example 1: Case-sensitive sort of employee names
let
Names = Table.Column(Employees, "FullName"),
Sorted = List.Sort(Names, Comparer.Ordinal)
in
#table({"FullName"}, List.Transform(Sorted, each {_}))Result
FullName | |
|---|---|
| 1 | BOB JONES |
| 2 | Charlie Brown |
| 3 | Eve Martinez |
| 4 | alice smith |
| 5 | diana PRINCE |
| 6 | frank lee |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks