# Need Help to sum up trip points per day

**URL:** https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134
**Category:** Ask for Help
**Created:** [October 20, 2023, 6:55am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134 "2023-10-20T06:55:32Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Guilio\_Del\_Fava](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/guilio_del_fava/32/65469_2.png) [@Guilio\_Del\_Fava](https://community.glideapps.com/u/Guilio_Del_Fava)
#### Post date: [October 20, 2023, 6:55am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/1 "2023-10-20T06:55:32Z")

</div>

Hi All, i need help please. I am building a trips section of my vehicle mileage app. I user is assigned 60 points at the start of each day for good driving behaviour. If they drive well and no points are deducted for the day they bank the 60 points. If they have any points deducted after each trip then the banked balance for the day is reduced by for example 4 points for mild speeding. So they only bank 56 points on that day.

What I need help with his how to do deduct the total deducted points from all the trips for the day from the daily 60 points and then show the banked points balance?

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [October 20, 2023, 7:15am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/2 "2023-10-20T07:15:08Z")

</div>

- In your Trips table, create a Query column that targets the same table, and uses the following filters:  
– Date is within This Row → Date  
– User is This Row → User
- Create a Rollup column that targets the Query column and takes a sum of the Points Deducted column
- Use a Math column to subtract the above from 60.
- The result is the number of points to be banked for each day.

---

<div class="post-metadata">

### Author: ![Guilio\_Del\_Fava](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/guilio_del_fava/32/65469_2.png) [@Guilio\_Del\_Fava](https://community.glideapps.com/u/Guilio_Del_Fava)
#### Post date: [October 20, 2023, 9:02am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/3 "2023-10-20T09:02:09Z")

</div>

Thank you Darren that worked.

The last step I need is to sum up the total daily banked points from the trips table and add it to the Monthly Reports table. Would I use a query column for that as well?

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [October 20, 2023, 9:04am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/4 "2023-10-20T09:04:27Z")

</div>

Perhaps. What is the structure of your Reports table. Can you show me what it looks like?

---

<div class="post-metadata">

### Author: ![Guilio\_Del\_Fava](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/guilio_del_fava/32/65469_2.png) [@Guilio\_Del\_Fava](https://community.glideapps.com/u/Guilio_Del_Fava)
#### Post date: [October 20, 2023, 9:15am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/5 "2023-10-20T09:15:54Z")

</div>

Would it be best to send a link to join as an admin as the table is very long with other data and i am not sure exactly the data you need to see?

This is the column i need to get the total for. The driver gets a maxmium of 1800 drive points for the month. So his total is banked points less his deducted points.

 ![Screenshot 2023-10-20 at 11.14.08](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/8/e8b90358ab463f4ae25af21c6769ede7560f18d4.png)

---

<div class="post-metadata">

### Author: ![Guilio\_Del\_Fava](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/guilio_del_fava/32/65469_2.png) [@Guilio\_Del\_Fava](https://community.glideapps.com/u/Guilio_Del_Fava)
#### Post date: [October 20, 2023, 9:21am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/6 "2023-10-20T09:21:57Z")

</div>

Apologies, i just need to some up the daily banked points as a total for the month.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [October 20, 2023, 9:28am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/7 "2023-10-20T09:28:48Z")

</div>

So the Total Daily banked points for all users for the current month?

---

<div class="post-metadata">

### Author: ![Guilio\_Del\_Fava](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/guilio_del_fava/32/65469_2.png) [@Guilio\_Del\_Fava](https://community.glideapps.com/u/Guilio_Del_Fava)
#### Post date: [October 20, 2023, 9:30am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/8 "2023-10-20T09:30:56Z")

</div>

The total banked points for each user for the month. Not all the users.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [October 20, 2023, 9:48am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/9 "2023-10-20T09:48:05Z")

</div>

Okay, so you should do this in your Users table, as your Users table contains one row per user.

Now, as your Trips table will contain multiple entries per user per day, you cannot rollup the daily totals directly because you will have duplicate totals. So you need a way to rollup the unique daily Banked Points for each user. Here is what I recommend:

- Start by adding a RowID column to your Trips table, if you don’t already have one.
- Next create a Math column that will take the Trip Date for each row and convert it to a number in YYYYMM format. Use the following formula:

```auto
Year(Date) * 10^2 + Month(Date) 

```

- Now create a Single Value column that takes the first RowID from the Query column that you created earlier.
- Now an if-then-else column:  
– If Single Value RowID is RowID, then Daily Banked Points.  
– Else 0
- Now create a Math column in your Users table that uses the same formula as above, but use the `Now` value as a replacement.
- And next a Query column in your Users table that targets your Trips table, with the following filters:  
– User is This Row → User  
– MathDate is This Row → Math Date
- Finally, a Rollup column in your Users table that targets the Query column and takes a sum of the above if-then-else column.

If you do all the above correctly, the last column should give you a sum of the daily banked points for each user for the current month.

---

<div class="post-metadata">

### Author: ![Guilio\_Del\_Fava](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/guilio_del_fava/32/65469_2.png) [@Guilio\_Del\_Fava](https://community.glideapps.com/u/Guilio_Del_Fava)
#### Post date: [October 20, 2023, 10:39am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/10 "2023-10-20T10:39:28Z")

</div>

I believe i have done all the steps as you instructed and I am getting a total. However the total is incorrect. As you can see from the screenshot the value in the ifSingle column is taking the total points from the first trip of that day and not from the trip that had the deduction, as the banked points for the day.  
 ![Screenshot 2023-10-20 at 12.35.42](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/4/e4bf46b9a782ff55e43fb6bb92665dac2f6c5725.png)

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [October 20, 2023, 10:52am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/11 "2023-10-20T10:52:13Z")

</div>

> [@Guilio\_Del\_Fava](#):
>
> As you can see from the screenshot the value in the ifSingle column is taking the total points from the first trip of that day

Yes, that’s what I intended.

> [@Guilio\_Del\_Fava](#):
>
> not from the trip that had the deduction, as the banked points for the day.

The daily banked points should have a value in every row, so that shouldn’t matter.  
Sounds like you have set up the calculation for daily banked points slightly differently from what I suggested.

---

<div class="post-metadata">

### Author: ![Guilio\_Del\_Fava](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/guilio_del_fava/32/65469_2.png) [@Guilio\_Del\_Fava](https://community.glideapps.com/u/Guilio_Del_Fava)
#### Post date: [October 20, 2023, 11:00am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/12 "2023-10-20T11:00:25Z")

</div>

Thanks I have found the issue. I had selected a different column instead of the query column for the deducted points rollup. It’s working correctly now.

Thank you so much for you help.

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [October 27, 2023, 11:00am UTC](https://community.glideapps.com/t/need-help-to-sum-up-trip-points-per-day/67134/13 "2023-10-27T11:00:27Z")

</div>

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