Calculate total of a column in a table

Hi everyone,
could you tell me where can find information or the code to simply calculate the sum of a number in the column of a table (in the site, not in the dbms) and make it visible in a separate field on the same page?

I can’t find a solution. Thanks in advance as always !!!

https://www.wix.com/corvid/forum/search/sum-up

Ehm, thanks,
I had already searched and found many of these answers, but either they are not complete, or there are no explanatory links, or sent back to external sites that are no longer public.

Point out that my table is already created and filtered. So it is anchored to a dataset.
I should sum up the numbers in the price column and show the total back into a field.

can you help me?

@info60119 you can try something like:

let tableRows = $w("#table1").rows;
let sum = tableRows.reduce((a, b) => a+ b.fieldKey, 0);//instead of fieldKey use your column key
$w("#text1").text = sum.toString();

Put all of this inside $.onReady() and dataset.onReady()