# How to use the Rollup mapper (with Sort)

**URL:** <https://community.synatic.com/t/how-to-use-the-rollup-mapper-with-sort/81>\
**Category:** Mapper\
**Tags:** rollup, sort, aggregate-function\
**Created:** [March 12, 2021, 12:23pm UTC](https://community.synatic.com/t/how-to-use-the-rollup-mapper-with-sort/81 "2021-03-12T12:23:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaun](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.synatic.com/shaun/32/7_2.png) [@shaun](https://community.synatic.com/u/shaun)\
**Post date:** [March 12, 2021, 12:23pm UTC](https://community.synatic.com/t/how-to-use-the-rollup-mapper-with-sort/81/1 "2021-03-12T12:23:16Z")

</div>

The **Rollup** mapper step allows you to rollup fields within your data set. The rollup operations available are:

_1. Sum_  
_2. Average_  
_3. First_  
_4. Last_  
_5. Min_  
_6. Max_  
_7. Count_

If you are familiar with transact SQL (T-SQL), then the **Rollup** mapper works very similarly to applying an aggregate function on a field and grouping on an identify field.

To demonstrate how to set this up, I will use a working example. In my data set I have a detailed list of cases in my helpdesk system, but I want to return a result of the number of cases per assignee.

The first thing I will need to do add a **Sort** mapper step to my flow. _NB! This is a critical step and needs to be used in conjunction with the Rollup mapper if our data is not sorted by the field we want to “group” by._

In my example, I am grouping by Assignee, so I will sort my data by assignee as per below. (You can add multiple fields to sort by).

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/8dfd58723d3b44efa69bf409e22455424b7f0f0e.png)

Following on from this, I will add a Rollup mapper step. I will list Assignee as my **ID Field** (the field I want to group by). Under the **RollUp Fields** section I will list the Operation I want to use (i.e. Count) and the field I want to apply it to (i.e. CaseID). Under the To Field, I will list the field name I would like to set to the counted records (I.e. Count).

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/32c14d2b24fd643ed5acd35599a362afc67fa698.png)
