How can I filter a Vega data table to unique values of a field?

Hello All,

I have data that I am querying, and I want to be able to filter to unique values of a field on the data in the table, can I do that? If so can someone explain to me how?

Thank you!

Hi @nsimi, I can think of several ways to create a table with just the unique values of a certain field.

  • Use aggregate transform to group by the needed field -- this will create a table with each row representing each unique value (could be multiple fields too).
  • Use window transform to either group rows (similar to aggregate), or to do a more fancy processing, i.e. sort by the value, and use the lag operation to get the previous (-1) value of the field. Afterwards use the filter transform to compare current and previous values, and if they are the same, filter them out.

@nyuriks Thank you!

At first I was having an issue where it wasn't working it was grouping everything as one group then I realized I had it pointed at the wrong data set

Thank you!