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.

Difference between two records with Self Join

Featured Replies

I’m using the technique described in Difference.fmp12 to find the difference between values on one record and on a previous record. The technique uses a self-join relationship and the Last function.
I use the following formulas:
Total = Amt1 +Amt2
Total2 = Last(Self_difference2::Total), where Self_difference2 is the self-join TO
Change = formula If(IsEmpty(Total2),””,Total -Total2)
The if statement suppresses the output on the first record since there is no previous record.
The technique seems to be dependent on the sort order. However, in one file I find the records must be sorted ascending and in another file the records must be sorted descending. No sort order is specified in the self-join relationships.
Can anyone explain this?

Where did you get the file Difference.fmp12 ?

  • Author

It was included in a message on this site. Sorry, but I don't remember which one. Something to do with getting the difference between two records. I'm including a copy with this response.

 

 

Difference.fmp12

Hello,

The calculation is base on the display so it depends of the order

You can do it without any link, it would run with any sort

Difference.fmp12

  • Author

I'm not sure what you mean about "link". In one file the records must be sorted ascending by date, and in the other descending by date. Strange.

If you see at the file i posted you'll see that there is only one table in the graph.

In your file there is two tables in the graph that's what i mean with link.

In my solution, the sort isn't important, the calculation always work

  • Author

Great solution Tom! Very simple and easy to use. Many thanks for your help.

No problem,

you could say it's resolved

Tom

Create an account or sign in to comment

Important Information

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

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.