Jump 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.

Difficult Relationship- Sum sales by month

Featured Replies

I am rewriting a database system that used a calculation field for each month and year to calculate the sales for a given company. So there is Jan04TotalSales...etc for each month.

I'd like to try to get out of that by using relationships a bit better (if possible). So, if you have these tables:

Sales - holds a record per sale, and contains a companyId

Company - holds a record per company

And then I want to be able to look at a record for the company, and view their cases summed by month (in regular browse mode).

Is there a better way than a calculation field per month and date?

One way is to create a stored calculation field in the Company table that holds the month and year. Then create a relationship using that field and create a calculation field that sums all sales fields from that relationship.

I suppose you could even make it self relating with that field in every sales record showing the current total for the month of that record but that would slow things down a little.

  • Author

What about creating a record per month/year, per company.

So a table called MonthlyCompanySales where it had fields for companyID, month, year, and the number of sales. If I have 4,000 companies, that would accumulate to 48,000 records per year. Would that be too much?

Hi,

Be sure I'm perfectly cautious in advocating this here, but in this very particular case, I'd use repeaters to store the stats as this is the kind of data :

- that you can easily reference afterwards

- frozen in time

- fixed in length (12 months*N years)

- browsable

- managable as arrays for statistical displays

- quicker than any relationships if you need to perform calcs from them.

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.