I have js csr code run in sharepoint 2013.
| Title | Paid | OutPut
| -------- | -------- |
| A | 2 |
| B | 100 | A 22
| A | 20 | B 110
| B | 10 |
If i enter any third value (paid) in A or B than NAN shows
| Title | Paid | OutPut
| -------- | -------- |
| A | 2 |
| B | 100 | A 22
| A | 20 | B NAN
| B | 10 |
| B | 10 |
I want more than two values with same Title entered and sum answer shown. A 22
B 120
code image attach


Amira BedhiafiRank #601 · 4K reputationPosted Aug 3, 2025, 1:35 PM EDT
Hello Anees !
I think that the value is not properly parsed to a number (
parseFloatreturnsNaNforundefinedor non-numeric values). You should use theisNaN(paidValue) ? 0 : paidValueto skip non-numeric or missing values safely.Also reduce(..., 0)to make sure that your initial value is numeric.var newValues = []; ctx.ListData.Row.forEach(function(item) { var isDuplicate = newValues.filter(v => v.Title == item.Title); if (isDuplicate.length === 0) { var hasSameTitle = ctx.ListData.Row.filter(v => v.Title == item.Title); var itemsSum = hasSameTitle.reduce((total, current) => { var paidValue = parseFloat(current["Paid"]); return total + (isNaN(paidValue) ? 0 : paidValue); }, 0); item["Paid"] = itemsSum; newValues.push(item); } });