Concept | Top N recipe

See the video version of this article

The Top N recipe allows you to filter a dataset based on the top and bottom values of some of its rows.

Slide detailing components of the Top N recipe.

You can use Top N to solve business use cases that involve the top and bottom rows of a dataset or the top and bottom rows of groupings of a dataset. For example, after building a prediction model, you might want to isolate just the top and bottom predictions so that you can set up specific marketing campaigns for each group.

Your results will depend on how you configure the sort in the tool. For example, if you sort in descending order, the highest values will be at the top.

Slide depicting how table of data extracts top and bottom rows.

There are additional configuration options in the configuration panel of the recipe for advanced use cases. For example, you can retrieve rows from the whole dataset or from groups of rows, such as country.That way, if your dataset contains a revenue prediction by customer as well as the customer’s country, you could use Top N to retrieve the 10 most promising customers for each country.

Finally, you can configure the Top N Recipe to make computations and include them in the output. For example, you could compute the count of rows in the whole dataset, or the row’s rank.