Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.filemaker > #1935

Re: calc field to show average of previous set number of records

From Your Name <YourName@YourISP.com>
Newsgroups comp.databases.filemaker
Subject Re: calc field to show average of previous set number of records
Date 2014-12-11 09:26 +1300
Organization Aioe.org NNTP Server
Message-ID <111220140926367717%YourName@YourISP.com> (permalink)
References <53b8592a-cc87-40b6-be2a-ec5886ef5c2a@googlegroups.com> <1lwgdlo.elpbk2rt7gi8N%clkaufmann@gmx.ch>

Show all headers | View raw


In article <1lwgdlo.elpbk2rt7gi8N%clkaufmann@gmx.ch>, Christoph
Kaufmann <clkaufmann@gmx.ch> wrote:

> Alex wrote:
> 
> > Each record is a day, and has a number field for total sleep.
> > 
> > Can a calculation field be created to show the sleep average for the last
> > 2 days, another field to show it for the last 3 days, and another field
> > to show it for the last 7 days?
> 
> Yup. The calc is quite simple:
> 
> avg ( lastsevendays::sleephours )
> 
> Lastsevendays is the name of a new occurence of your table. You create a
> relation based on
> 
> Days                    Lastsevendays     
> Date              >=    Date
> DateteMinus7_c    <     Date
> 
> DateMinus7_c is a new unstored calc field, result type date. It's calc
> is date - 7.

That should work, and similar relationships for 2 and 3 days.

Since the relationships only ever have up to seven records, it should
be fast, even on an ancient slow computer (unlike an average over all
records, which would slow down as the number of records grows).

Even easier is don't sleep, then the new average calculation field
simply needs to be:

      AverageSleep = 0

;o)

Helpful Harry  :o)

Back to comp.databases.filemaker | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

calc field to show average of previous set number of records Barbara Fakoury <bfakoury@gmail.com> - 2014-12-10 07:42 -0800
  Re: calc field to show average of previous set number of records Martin Τrautmann <t-usenet@gmx.net> - 2014-12-10 17:16 +0000
  Re: calc field to show average of previous set number of records clkaufmann@gmx.ch (Christoph Kaufmann) - 2014-12-10 19:27 +0100
    Re: calc field to show average of previous set number of records Your Name <YourName@YourISP.com> - 2014-12-11 09:26 +1300
  Re: calc field to show average of previous set number of records Jeremy Bante <jeremy.bante@gmail.com> - 2014-12-10 12:30 -0800

csiph-web