# Data Source Math

**URL:** <https://community.thunkable.com/t/data-source-math/1642382>\
**Category:** Questions about Thunkable X\
**Created:** [December 1, 2021, 2:27pm UTC](https://community.thunkable.com/t/data-source-math/1642382 "2021-12-01T14:27:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![doubleaainc109](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@doubleaainc109](https://community.thunkable.com/u/doubleaainc109)\
**Post date:** [December 1, 2021, 2:27pm UTC](https://community.thunkable.com/t/data-source-math/1642382/1 "2021-12-01T14:27:53Z")

</div>

Hi. My partner and I are creating an app that allows you to input activities with duration, and it takes that information, puts it into a data table, and calculates the stress level after clicking a button. Basically, we need to figure out how to take the numbers from the data table and add them together, to then divide them by 24. We have tried TONS of different pieces of code, to find out they don’t work. The closest we got, was by using the “list of values” block. (Picture included). However, that block only used the math on the first added event. Can we have some assistance? I included a picture of the project and the list of values blocks. Thanks!

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/e/deaeb9f0dd9596c1e73ff96c71d15450db013cf0.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/3/f355c410ce1afb294769d25dcccd23f30ee46926.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 1, 2021, 3:59pm UTC](https://community.thunkable.com/t/data-source-math/1642382/2 "2021-12-01T15:59:55Z")

</div>

The “list of values” block creates a list like {3,4,9,15}. You can’t add those together. Instead, replace each one with a “get value from” block from the Data Sources drawer.

Please give an example of the values you’re wanting to add together because it’s not clear from your post.

If you’re adding a whole bunch of numbers together, you can either use a whole bunch of + blocks from the Math drawer or you can loop through the “list of values” and add each iteration of the loop to a variable. That’s what I would do.

---

<div class="post-metadata">

**Author:** ![doubleaainc109](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@doubleaainc109](https://community.thunkable.com/u/doubleaainc109)\
**Post date:** [December 1, 2021, 4:13pm UTC](https://community.thunkable.com/t/data-source-math/1642382/3 "2021-12-01T16:13:15Z")

</div>

So basically, the user writes a number in a text input, it then creates a value in the data source which is what the number added is. What we need is, to have all numbers in the data table add up, and divide by 24.

@tatiang

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [December 1, 2021, 4:55pm UTC](https://community.thunkable.com/t/data-source-math/1642382/4 "2021-12-01T16:55:38Z")

</div>

You should do it in a way similar to this

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/8/c8e3b945eab9b175571c70375dd4aa4b32cd8b81.png)

This is the content of the table  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/6/0663ce9d434f071f790afd026a19f55c12287e87.png)

This is the output  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/3/e3ed850b05dac009613ad795cf0c316bf44f54c6.png)

---

<div class="post-metadata">

**Author:** ![doubleaainc109](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@doubleaainc109](https://community.thunkable.com/u/doubleaainc109)\
**Post date:** [December 1, 2021, 5:22pm UTC](https://community.thunkable.com/t/data-source-math/1642382/5 "2021-12-01T17:22:27Z")

</div>

Thank you!!! I will try it out later

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [March 1, 2022, 5:22pm UTC](https://community.thunkable.com/t/data-source-math/1642382/6 "2022-03-01T17:22:31Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
