Question

How to create a DENSE_RANK?

  • 13 January 2022
  • 0 replies
  • 13 views

Userlevel 1

 Hey guys,

so, I’m trying to build a ranking for my clients. Most of the variables that I’m using I can use the rank() in table calculation.

With that, I am able to use other set of functions, suck as lookup(). 

lookup(row(),rank(${aum}, ${aum}), ${brand_name})

 

 

However, some variables return same rank position, and using lookup, doesn’t give me the output that I want.

Thinking now, I see that the only way that would work is using a dense_rank( ) calculation, but it seems that Looker doesn’t have one.

 

I’ve tried some calculations like:

max(row())-rank(${order_items.count}, ${order_items.count})+1

 

count_distinct(offset_list(${field_to_rank}, -1 * row() + 1, row()))

But none of them worked. 

 


0 replies

Be the first to reply!

Reply