Obtaining a total to a column

Hey I don’t know if you could solve this but I have find a way to do it.

$w('#dataset1').onReady(function(){
 var total = 0;
 for (var i = 0; i < $w('#table1').rows.length; i++) {
            console.log($w('#table1').rows[i]["total"]);
            total = Number(total) + Number($w('#table1').rows[i]["total"]);
            console.log ("Total:" + total);
        }
        $w('#text12').text = String("$" + total);
    });