Field sum and display in member-only page

Hi all
I have a table that contains users actions (the user do something and a record is being saved in the table).
I want to display the sum of a field (named ‘happy’) from that table, for each user in a private page (a member-onle page).
After reviewing many answers in the forum, I still didn’t really find how to do so.
the code I wrote is:

import wixData from 'wix-data';
import wixUsers from 'wix-users'

export function button1_click_1() {
  let user = wixUsers . currentUser;
  let userID = user . id;

$w.onReady(function () {
    $w("#dataset1"). setFilter(wixData .  filter()
    .then((data) => {
        var sumTotal = 0;
        let items = data.happy; // get the array of returned items
        items.forEach(item => {
           sumTotal += item.value; // add each value to sumTotal
        $w("#text39").text = "" + sumTotal; // make sumTotal a string

The value data is actually already an object with the items array in it. To correctly get the items array use the code below -

let items = data.items