Question

Identifying duplicate results in a column

  • 12 August 2020
  • 3 replies
  • 914 views

Hi Looker Community,


I’m currently looking for a way to identify if results contain any duplicates in a specific column. Can I use a table calculation to identify column duplicates? I’m looking more for a way to say yes/no rather than count the distinct total.


Thanks!


3 replies

Userlevel 5
Badge

Try this table calculation:


if(
count(${order_items.order_id})
- match(${order_items.order_id}, offset(${order_items.order_id}, count(${order_items.order_id})
- row() * 2 + 1))
+ 2 - match(${order_items.order_id}, ${order_items.order_id}) > 1
,"Duplicate"
,null
)

You should have the following behavior:

Hey Cyril - thanks so much this will do exactly what I’m looking to accomplish. Appreciate the guidance!


-Nick

Is there an easy way to filter the report to only show the Duplicate records?

Reply