# Need Help To Calculate Trip Distance Per Day

**URL:** <https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905>\
**Category:** Ask for Help\
**Created:** [April 24, 2023, 8:48am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905 "2023-04-24T08:48:17Z")\
**Posts on this page:** 8\
**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:** [April 24, 2023, 8:48am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/1 "2023-04-24T08:48:18Z")

</div>

I need help with my glide pages app please.

I have a trip screen were a user can start a trip by selecting the vehicle, the start date and the start odometer reading. They can then also stop the trip by editing the trip, entering the end odometer reading and then selecting a date and time the trip stopped.

What I need help with is calculating the trip distance per day? Anyone know how can do this?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Lucas\_Malguy1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_malguy1/32/54607_2.png) [@Lucas\_Malguy1](https://community.glideapps.com/u/Lucas_Malguy1)\
**Post date:** [April 24, 2023, 9:38am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/2 "2023-04-24T09:38:20Z")

</div>

Hi,

Do you create new rows every time a user start a trip, or is the row replaced when a new trip starts? And would you like see daily distances driven for **each** day or just the current 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:** [April 24, 2023, 10:31am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/3 "2023-04-24T10:31:29Z")

</div>

A new row is created every time a user starts a trip and calculates the distance of each trip. Here are some screen shots that may help you visualise it better. My thinking is to use a template column and together with the trip date add the total distance per day on the trips listing screen…

 ![Screenshot 2023-04-24 at 12.27.20](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/1/e1ddbf6349cdb90bec17932e826f2372b1551060.png)  
 ![Screenshot 2023-04-24 at 12.27.36](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/6/c66af56371cb3efaff9f11c72d99bfe11cd5cdce.png)  
 ![Screenshot 2023-04-24 at 12.27.51](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/5/857689972172b24d760c5c63719da337154ca01b.png)  
 ![Screenshot 2023-04-24 at 12.28.00](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/9/79bbfb3db2f12646eb4667acb01c38e7799618c7.png)

---

<div class="post-metadata">

**Author:** ![Lucas\_Malguy1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_malguy1/32/54607_2.png) [@Lucas\_Malguy1](https://community.glideapps.com/u/Lucas_Malguy1)\
**Post date:** [April 24, 2023, 10:41am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/4 "2023-04-24T10:41:03Z")

</div>

What you could do is format your trip date (either with the ‘format date’ column, or the ‘math’ column) so that you remove the hours.  
Then you create a relation columns between the formated trips’ date, and make it multiple. You can then use a rollup column to sum the trip’s distances from this relation.

---

<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:** [April 24, 2023, 10:59am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/5 "2023-04-24T10:59:00Z")

</div>

Am I creating a relationship in the Trips table between the Normal Start Date and The Formatted Start Date set to multiple?

---

<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:** [April 24, 2023, 11:08am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/6 "2023-04-24T11:08:08Z")

</div>

I go it to work, thanks for the reply. Much appreciated.

---

<div class="post-metadata">

**Author:** ![Lucas\_Malguy1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_malguy1/32/54607_2.png) [@Lucas\_Malguy1](https://community.glideapps.com/u/Lucas_Malguy1)\
**Post date:** [April 24, 2023, 11:52am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/7 "2023-04-24T11:52:39Z")

</div>

Perfect! Glad that it helped!

I answer if someone encounters the same issue someday. You have to create the relation between the formatted **itself**. It means that you select the formatted date in both data fields in your relation columns, and make it multiple.

---

<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:** [April 25, 2023, 11:53am UTC](https://community.glideapps.com/t/need-help-to-calculate-trip-distance-per-day/60905/8 "2023-04-25T11:53:01Z")

</div>

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