Jump to content

gain or loss between sucessive reccords


This topic is 2801 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I use the following calculation to determine the investment gain or loss between two successive records. The records are sorted by date descending.

Case

( Get(RecordNumber )>1;Total investment-GetNthRecord ( Total investment;Get(RecordNumber) -1 )

)

The calculation works well except that on the last record in the found set it results in a question mark. How can I eliminate the question mark? I would like the result to be be empty.

Link to comment
Share on other sites

Sorry about that. I changed the calculation after I posted it. ! It is:

Case
( Get(RecordNumber ) ≥ 1;Total investment-GetNthRecord ( Total investment;Get(RecordNumber) +1 )
)

It determines the difference between the current and next records.

The file is attached.

Assets.fmp12

Link to comment
Share on other sites

Well, if you're on the last record, then this part:

GetNthRecord ( Total investment ; Get(RecordNumber) +1 )

will error out.

You should change your test from:

Get (RecordNumber) ≥ 1

to:

Get (RecordNumber ) < Get (FoundCount)

That will make the last record empty and return a value for the first record (which does have a next record).

Link to comment
Share on other sites

This topic is 2801 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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