How to create a DENSE_RANK?

 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})
1d59048c-8a90-4a4a-bd7d-77b713113d4d.png

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

50517a70-54d5-473b-9e0f-ace4bb5fc57a.png

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 0 827
0 REPLIES 0
Top Labels in this Space