# Use the Window Recipe to Compute Customer Ranks by Year[¶](https://knowledge.dataiku.com/latest/courses/advanced-data-prep/data-pipelines/window-recipe.html#use-the-window-recipe-to-compute-customer-ranks-by-year "Permalink to this headline")

Although it is not yet built, we now have the **schema** of a dataset that groups purchases by customer and year. Our next step is to get a ranking of each customer’s spending in each year. We can do this with the Window recipe.

With the empty *orders\_grouped* dataset selected:

* Choose **Actions > Window**.

* Click **Create Recipe**.

In order to compute a ranking of spending by year, we need to compare each customer’s spending within a given year. In the Window definitions step of the Window recipe:

* Turn Partitioning Columns **On**, and select *order\_date\_year* as the partitioning column. This will group the output.

* Turn Order Columns **On**, and select *total\_sum* as the order column. Click the ordering button so that spending will be looked at in descending order .

* On the Aggregations step, select **Rank** to compute the rank for each row.

* Click **Save**, and accept the schema changes. (Again, do not run the recipe).
