Fetch unique records from a column

Hi guys,
I want to fetch the unique records from a column. Something like this:

$A              $B
X                  X
X                  Y
X                  Z
Y
Y
Z

This has to be so simple but somehow I can’t figure out how to achieve this on grist. I believe Python Set function could solve my problem but find no luck.

I think there is a nicer solutions but :

s=list(set(Table1.all.A))
if len(s)-$id+1>0 :
  return s[$id-1]

It works on my side

Usually you would make a Summary Table grouped by $A: Summary tables - Grist Help Center

Does that work for your use case?

1 Like

Not working on my end. I tried to fetch data from another table but it seems blank. I wrote the piece of code on the formula column field.

Works only if you need A & B in the same table (nbr of A row = nbr of B row) but best design is the summary table