Matching Workflow: How to limit rows dynamically by group?

I have a list of creators and a list of brands. I’ve combined the two tables to find relevant matches (e.g. are in the same content area), e.g.

  • Creator 1, Brand X
  • Creator 1, Brand Y
  • Creator 2, Brand Y
  • Creator 2, Brand Z
  • Creator 2, Brand N

For each creator, I want to now limit the results so they get only 10 matched brands. How can I go about doing this? The ‘limit rows’ doesn’t work in this case since each Creator needs to have 10 brands each. Also the # of creators is big and dynamic so I can’t set up separate filtered tables. Thanks!

Hi @Movig - Welcome to the Community! I know we chatted about this Flow earlier so excited to see the progress you make on it!

One way that you could do this is to use an Add row numbers step and under the Number Settings section, number based on the unique identifier column that you are using for the creator. The number column will number the rows for each unique creator so if one creator has 20 rows, they will be numbered 1-20 and if another has 14, they will have 1-14 in that column, etc.

From there, use a Filter rows step and set it to keep rows where that row number column is less than or equal to 10. This will keep the first 10 rows for each creator!

Let me know if you have any questions!

Thanks yes we did this and is working well! Quick question is there a way to randomize before adding the row number step? so that it’s not necessarily just the first 10 that come from the initial pull