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.

Calculating percentage from many entries

Featured Replies

Hello

I have a new problem to solve and I'm not to sure how.

I have a table that shows Percentage of accomplishment for a type of job. The same job can be accomplished over several weeks and I need to find the percentage between the two last entries.

example of the data entry

Date-------- Job %

28-05-2010 15%

04-06-2010 75%

18-06-2010 100%

How can I calculate the difference in percentage from the last two entries (result being 25%) and ignore the previous week(s)? Keep in mind that there can be several weeks between two entry.

I'd prefer to have a calculation field for this but it can also be integrated into a script. I will use this data to build a report (starting from another table).

Thank you.

Try =


Let ( [

n = Count ( Percentages::JobID ) 

] ;

Last ( Percentages::Job% ) - Case ( n > 1 ; GetNthRecord ( Percentages::Job% ; n -  1 ) )

)

This assumes that entries are in chronological order.

  • Author

Hello

I can't get it to work.

I made a small db for you to try... again :

PercentDB.fp7

Thank you

I thought this was being calculated from the Jobs table?

  • Author

No I can't. I'm also using a portal to show only the related record. Any other idea how I can get this percentage?

I don't understand. The "last two entries" are obviously the last two entries for the SAME job, so the difference between them is an attribute of job. Don't see what the portal has to do with it.

  • Author

You're right. I was just mentioning it in case it could help in some way. But it's just the same.

So did you get it to work?

  • Author

No I'm trying again right now. You know I will have to transfer that percentage in my Report table so I guess I could do it in a script as well.

  • Author

I did it with a script.

  • Author

Now explain to me why your calculation works if put in another table and why it doesn't from the percentage table itself?

The Last() function works over a relationship, not found set (and it would have a hard time to pick the last record of each job in the found set). Similarly, GetNthRecord uses the relationship to filter out records of other jobs, so the last-but-one record is job-specific.

It's possible to calculate the same thing in the Percentages table, using a different formula. But it would be correct only when records are sorted by job and by date.

  • Author

Thank you I'll try to remember that.

btw I use a portal to enter the percentage and it is sorted by job# and date.

Anyway it work just fine with the script and the variables. Maybe even better because I feel I have a better control over the dates. So I will leave it that way. It's more convenient.

Thank you for your help.

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.