Help understanding example on tutorial

I am looking at doing something similar to the Aggregations example on:

but instead of months, I want the table populated with Members that are already in my collection. How do I modify this code to be the member’s names without duplicates (my data has multiple entries per member).

This is what I have changed it to so far:

$w.onReady( function () {
$w(“#table1”).columns = [
{
“id”: “col1”,
“dataPath”: “member”,
“label”: “Member”,
“type”: “string”
},
{
“id”: “col2”,
“dataPath”: “totalpts”,
“label”: “Total Points”,
“visible”: true ,
“type”: “number”
}
];

wixData.query(“TxResults”)
.ascending(“totalpts”)
.limit(1000) // include a limit if you have more than 50 items
.find()
.then( (result) => {
const members = result.items.map(x => x.member)
.filter((obj, index, self) => index === self.indexOf(obj));
const aggregated = members.map(x => {
return {
member: x,
totalpts: result.items.filter(obj => obj.member === x)
.map(z => z.totalpts)
.reduce((sum, current) => sum + current)
};
} );

$w("#table1").rows = aggregated; 

} );
} );