Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Moving Average Calculation Field

Featured Replies

  • Newbies

I'm new to Filemaker though I have experience with MySQL. I have a very simple, one table database of stock quotes:

Date Symbol Open High Low Close Volume

-----------------------------------------------------------

10/31/08 ABC 10 12 9 11 9990303

10/31/08 DEF 20 22 18 21 1909933

.

.

.

I'm trying to create a calculated field that lists the trailing "moving" average for each stock based on the last 5, 10, 30 day:

Symbol 5dayAVG 10dayAVG 30dayAVG-------------------------------------------------------------------------

ABC 11 10 9

DEF 22 20 18

.

.

.

In MySQL this is straightforward, you'd have code that looks approximately like:

AVERAGE(SELECT close FROM quotes WHERE date is <=today...5 days ago AND symbol=this.symbol)

AVERAGE(SELECT close FROM quotes WHERE date is <=today...10 days ago AND symbol=this.symbol)

AVERAGE(SELECT close FROM quotes WHERE date is <=today...30 days ago AND symbol=this.symbol)

Is there a way to do this in Filemaker? I'm struggling trying to figure out a way to do 'Find' queries as part of calculations. Scripting seems capable of running multiple queries but what I really need is these moving averages as calculated fields in the same table as the plain quotes.

Any advice?

Thanks,

Chew

In Filemaker, this is a two-step process: first, you need to define a self-join relationship for each of the SELECT statements. Then you can have calculation fields to aggregate the related records.

  • Author
  • Newbies

Thanks, I'll investigate doing this.

Chew

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.