Question

Why Looker always do order by one first measure on the look?

  • 10 March 2017
  • 4 replies
  • 1094 views

Userlevel 2

Hi,


Looker always does sorting on first measure on the look eventhough sort is define at the dimension (which is on hte look group by) level. Is it possible to change it by dimensions, if user add them on the look? Only option right now i see is I have to sort by dimension on the looks and then save the look.


4 replies

Userlevel 5
Badge

Hi @kshah7, you are correct that right now the only way to change the sort order is to manually decide your sort order and then save the result as a Look.


Looker decides how to sort based on the following rules:


1. The first date dimension, descending. If no date dimension exists...
2. The first measure, descending. If no measure exists...
3. The first added dimension (ascending)

We’d love to hear more feedback about your use case, and what would work better for you than manually sorting. Are you thinking of a LookML parameter that tells Looker that a given field should be sorted on first, or perhaps an Admin toggle that tells Looker to sort by the most recent field added? Any information you can share on what exactly your goal is would be very useful to us.

Userlevel 2

Hi Sam, is it possible to sort on dimensions (all) on which we already have order_by_field defined at the object level. So whenever user bring them on the look data will sort on them (one or all) by default. Can we have feature request for this and also give me request number so I can check status with support team?

Userlevel 5
Badge

Thanks for explaining further @kshah7. I’ll email you the number separately.

[bumping this thread up]

 

Not sure where this fell on Looker’s roadmap, but a measure parameter that changes the default drill sort criteria , rather than following the ranking @sam mentioned would be very helpful. 

 

A workaround we’re currently leveraging is creating a dummy measure, hiding it, and using a liquid link like the following: 

 

    link: {
      label: "Details"
      url: "{{ measure_dummy._link }}&sorts=view.measure+desc"
    }

 

While this works and provides the desired user experience, this adds a lot of mess in our LookML and isn’t ideal.  

Reply