Loading

Considerations for Sort Order in CRM Analytics Queries Using SAQL and Extended Metadata

Publiceringsdatum: Apr 30, 2026
Beskrivning

Sort Order Behavior

When changing the sort order of data in a chart or table, column values are ordered by the encoded character value. This means that numerals have lower values than uppercase letters which have lower values than lowercase letters and some punctuation will be interspersed in the results:

!
%
01
010
010A
010a
01A
01a
02
020
1
10
10A
10a
1A
1a
2
20
A
AA
Aa
B
[
_
a
aA
aa
b
{
~

 

Dimension Value Labels

Labels for Dimension Values can be defined within the Fields or declared in the Extended Metadata (XMD) for a dataset. Information on this can be found in Change the Labels and Colors of Dataset Dimension Values .
 
These labels are interpreted by the UI and are not involved in the "order" statement within queries. This may result in the order of groupings, chart legends, or unsorted columns to appear "out of order" if user-defined labels are in place. More documentation on the order statement  is in the SAQL reference material.
 

Example 

Column Value User-defined Label
Closed - Won100% - Won
New0% - New
Pending50% - Pending
 

This will result in the following display order:
 
100% - Won
0% - New
50% - Pending

 
Lösning
To ensure values display in the expected order, the raw data in the dataset must already be sorted alphanumerically, because the query operates on raw values before CRM Analytics applies user-defined Extended Metadata labels.

The query operates on the raw data, then the UI applies the custom labels. The raw data will need to be in the expected alphanumeric arrangement to allow the order to display as expected:

 

Raw DataXMD Label
100% - Closed - Won100% - Won
000% - New0% - New
050% - Pending50% - Pending


This will result in the following display:

 

0% - New
50% - Pending
​100% - Won
Knowledge-artikelnummer

000381639

 
Laddar
Salesforce Help | Article