How to Create Summary Page with all the Names (without Replicating) and getting the total for each person

How to Create Summary Page with all the Names (without Replicating) and getting the total for each person

Greetings.

I am in the process of finalizing a vacation / sick leave tracker and just need one more thing.

How can i list all of the names of the people who submitted a leave request and get the total # of days (a field in the form) without replicating each instance of the names of the people who applied for a leave.

Here's the formula i tried:

<%{
    for each x in Create_Leave_Request
    {%>
<tr>
<td>
<%=x.Name1%>
<td>      
<td>
<%=x.of_days_applied%>
</td>
<tr>

However, what it does is it list all of the names of the people who submitted a leave request with the corresponding # of days.

Here's the sample HTML output:  (David is just one person and has 15 used leaves in total)

David          2
John            5
Jack             3
David          13

instead, here's what I have in mind that should be displayed:

David          15
John            5
Jack             3

A solution to this problem is highly appreciated.

Thank you.

- David