# Footer sum() with decimal places

# Footer sum() with decimal places

Hello,

in one column of my table I output the sum in the footer. For this I use the sum() plugin. Unfortunately the decimal places are not displayed.

Here is my code:

```
footerCallback: function(row, data, start, end, display) {
var api = this.api();
api.columns(".sum", {
page: "current"
}).every(function() {
var sum = this
.data()
.reduce(function(a, b) {
var x = parseFloat(a) || 0;
var y = parseFloat(b) || 0;
return x + y;
}, 0);
$(this.footer()).html(sum);
});
},
```

Values are:

723,08

273,53

12,75

123,75

The output in the footer is 1131.

So it looks like that the decimal places are already ignored during the calculation.

Greetings

Jan

This question has an accepted answers - jump to answer

## Answers

See if this SO thread regarding parseFloat and commas helps.

Kevin

Hey Kevin,

thanks for your answer. Didnt expect that this was an parseFloat issue.

issue solved

Jan