# Diffferent formula from Row 2 onwards

**URL:** <https://community.glideapps.com/t/diffferent-formula-from-row-2-onwards/75370>\
**Category:** Ask for Help\
**Created:** [August 2, 2024, 12:20am UTC](https://community.glideapps.com/t/diffferent-formula-from-row-2-onwards/75370 "2024-08-02T00:20:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![don\_pablo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/don_pablo/32/75929_2.png) [@don\_pablo](https://community.glideapps.com/u/don_pablo)\
**Post date:** [August 2, 2024, 12:20am UTC](https://community.glideapps.com/t/diffferent-formula-from-row-2-onwards/75370/1 "2024-08-02T00:20:40Z")

</div>

![Screenshot 2024-08-02 at 7.09.28 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/a/7a8c08a1d99a44f96a5562ee1f1672fc05f56875.png)

How can i recreate this is glide tables? Everyone’s initial balance should be 0, then for the succeeding rows (in which case user should have had at least 1 previous transaction) - the starting balance should be the previous end balance.

side note: i was actually able to make the calculations work (including the +/- and only when status is “approved”) - but the display on the data table is incorrect, since as a workaround, i had to make the startbal a lookup that fetches the previous endbal, so it looks like this:

 ![Screenshot 2024-08-02 at 8.19.37 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/0/c0ad0d71b50d890a726ade2c3cc66cdc2d9de1a3.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [August 2, 2024, 12:58am UTC](https://community.glideapps.com/t/diffferent-formula-from-row-2-onwards/75370/2 "2024-08-02T00:58:05Z")

</div>

- Make sure you record the user’s ID/email.
- Use a query column, filter by user’s ID/email equals to this row \> user’s ID/email.
- Add a rowID column to your table.
- Add a lookup column on top of the query result, pointing to that rowID column, so you get an array of IDs for the same user.
- Add a find element index column, use the lookup result as the base, and look for the current row’s rowID. You will get a 0-based list of index for each user.
- Add a math column, with the formula being: I-1, with I being the index of the current row. This will give you the index of the previous row from the same user.
- Add a query column, use the query from the 2nd step as a base, filter by index equals to this row \> previous row’s index.
- Add a single column to fetch the first “EndBal” from the query above.

Now you got the EndBal from the previous row, you can proceed with calculating other things within your structure.

---

<div class="post-metadata">

**Author:** ![don\_pablo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/don_pablo/32/75929_2.png) [@don\_pablo](https://community.glideapps.com/u/don_pablo)\
**Post date:** [August 2, 2024, 2:00am UTC](https://community.glideapps.com/t/diffferent-formula-from-row-2-onwards/75370/3 "2024-08-02T02:00:32Z")

</div>

whoa! that’s a lot! will do my best to make it work. thanks again
