Displaying Sum of Column

Hi,

I've seen a few similar discussions and have tried the fixes, but can't seem to get them to work for me.

I have a column called amount that is not stored as a number.

I'd like to display the total of that column within the statistic option.

hey @iancole1989 ! here's how I've done it

1 Like

Hi @DavidD thanks for the quick response.

So when I try that...

{{_.sum(alltransactions.data.map(d=>parseFloat(d.amount)))}}

I get the following error "alltransactions.data.map is not a function"

I'm definitely missing something very obvious, but can't figure it out.

Thanks again

are you able to share a screenshot?
I assume alltracactions is your table?
is "amount" a string or some other data type?

Yes, that's my table name. And yeah, it's currently stored as a string.

Here's a screenshot. Thanks again.

hm....have you tried referencing the table instead of the query?
otherwise, you might need to make sure the data is formatted as an array with
formatDataAsArray(query1.data........)

Yeah, I think it's the fact it's not formatted as an array so will have a play around with that. Thanks for all your help.

1 Like