How do I display the sum of column returned from a dynamodb query?


I am trying out retool as an alternative to metabase for our companies internal analytics and metrics tracking. So far it seems more powerful but more difficult to learn which is understandable!

I'm just getting my feet wet but so far have been having issues doing very basic tasks and struggling to find documentation/examples.

What I'm trying to do is pretty simple. I have loaded in a table from dynamodb using a query. I have confirmed this data is loaded in and displayed it in a table by adding the following code to the data portion of the table:


The data returned by my query has quite a few columns but the column i am interested in right now is called amount. All I want to do is add a text component and within that text component display the sum of all the values in the amount column in the text component.

For example if the amount column contained the values:
[5, 2, 3]
I would want the text component to show the value:

I've been tearing my hair out trying to figure out how to do this. I've tried adding the following code to the text component value markdown:


But this tells me amount is undefined and every permutation I try has the same issue.

I suppose I need to know how to:

  1. Access all values in a single column in data returned by a query
  2. Sum the values in the column

I think I figured out how to do this. I used a statistic component instead of a text component which makes sense. The code I then put in the primary value field for the statistic component was: