Jump to content
Sign in to follow this  
BrownFedora

Summing trouble

Recommended Posts

We have a donation table with fields ID, Date, and Amount

We have a calculation field "CurrentYearTotal" that needs to display the sum of all donations (a sum of donations) made within the current year (Jan. 1st to today)

Can we do this with out a script and just a Calculation Field?

So basically how do I restrict the records that are summed without dong a find. We don't want to do a find because we want to be able to see all time grand total next to current year total.

I'll capitulate if a script is the only way to do it but I really prefer not to use one.

Share this post


Link to post
Share on other sites

You can do it, but it may run much more slowly than a script if you have a large number of records. You need a calculation number field cYearDate equal to Year(Date), an unstored calculation number field cYearNow equal to Year(Get(CurrentDate)), a self-relationship from cYearNow to cYearDate, and your CurrentYearTotal field equal to Sum(selfrel::Amount).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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