Calculation in a query from previous record. (1 Viewer)

Dorette

New member
Local time
Today, 17:45
Joined
Nov 18, 2020
Messages
1
Hi, hoping to find some help.
I am planning a database to calculate weekley weight loss progress. I need to entre the weight every week and then i need to subtract or plus the new entry from the previous entry. I will have a weighDate and weight column. Can someone please assit with the query. Note i do not want a running total, i just want the previous week from the current week.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:45
Joined
Oct 29, 2018
Messages
21,358
Hi. Welcome to AWF!

The principle is the same as a running sum query. You need a subquery to fetch the previous record for reference in the current record.

Take a look here for some examples.

 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:45
Joined
Feb 19, 2002
Messages
42,970
It is inefficient to do this in a query. Do it in the report. Use the built in sum function. You can use "over all" or "over group" depending on if you want to break on month or not.
 

Users who are viewing this thread

Top Bottom