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

Dorette

New member
Local time
Today, 06:22
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
Yesterday, 20:22
Joined
Oct 29, 2018
Messages
13,707
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
Yesterday, 23:22
Joined
Feb 19, 2002
Messages
30,570
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