# Concept: Top N Recipe[¶](https://knowledge.dataiku.com/latest/courses/visual-recipes/topn.html#concept-top-n-recipe "Permalink to this headline")

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

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.

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.
