Hi @harmen -
This is a great suggestion, this type of advanced sorting is not possible today.
Here is a workaround you can use.
Step 1 - Create a calculated field to switch the dimension of your chart based on a parameter value
c_measure_dim
// switch dim order by on parameter selection
ifelse(
${pmeasure}='Day of Week',dow,
${pmeasure}='Weather Type',{weather_type},
null
)
Step 2 - Create a calculated field to convert your date to a day of week (integer).
c_week_day
extract('WD',dt)
Step 3 - Use the rank function to rank the weather type by number of occurrences
c_weather_type_rnk
rank([count(dt) ASC])
Step 4 - Create calculated field for a custom sort order that will switch the sort measure based on the parameter
// switch custom sort order by on parameter selection
ifelse(
${pmeasure}='Day of Week',max({c_week_day}),
${pmeasure}='Weather Type',{c_weather_type_rnk},
null
)
Result:
