Default Sorting
By default, pivot columns are sorted alphanumerically from left to right:
Reverse Sorting
To reverse the order, you can click the right-facing arrow next to the pivot column name:
Custom Sorting
You can define a dimension to create a custom sort order using the case
parameter. When you pivot on the custom sort dimension, the order in which the when
parameters are defined dictates the sort order for the Explore:
dimension: status_custom_sort {
label: "Status (Custom Sort)"
case: {
when: {
sql: ${status} = 'pending' ;;
label: "Pending"
}
when: {
sql: ${status} = 'processing' ;;
label: "Processing"
}
when: {
sql: ${status} = 'shipped' ;;
label: "Shipped"
}
when: {
sql: ${status} = 'complete' ;;
label: "Complete"
}
when: {
sql: ${status} = 'cancelled' ;;
label: "Cancelled"
}
}
}
For example: