LookML order month name by chronologically

For the dimension time frame, I want to sort the month name by chronologically. how to edit the code below? 

dimension: timeframe{

  type: string
  sql:
  CASE
  WHEN{% parameter timeframe_picker %} = 'Month' THEN CAST(${order_month_name} as string)
  WHEN{% parameter timeframe_picker %} = 'Year' THEN CAST(${order_year} as string)
  END;;
}

0 1 1,223
1 REPLY 1

I would have look at the case statement provided by Looker: https://docs.looker.com/reference/field-params/case

The upside is that it generates exactly the same SQL as yours but it translates your case statements’ order into another CASE used in ORDER BY clause

Choosing the sort order of labels with alpha_sort

Typically, case values appear in the order you write them. If you prefer an alphabetical sort, you can use alpha_sort: yes like this:

Though I am not sure if it would solve all your problems, since you’re combining MONTH and YEAR at the same time. Could happen that you may need some Liquid

Top Labels in this Space
Top Solution Authors