Prior Year calculations

  • Thread starter Thread starter Meryl
  • Start date Start date
M

Meryl

I am trying to create a report that shows 2 total
donation totals per person side by side - one for the
current year and one for the prior year.

I have the code for the current year, see below, but I
can't figure out how to code it for the prior year. My
underlying query has all the donor transactions.

=Sum(IIf(Year(Now())=Year([Trans-Check Date]),[Amount],0))

Thank you!
 
Without knowing all of the details of what you're doing, what happens if you
add something along the lines of:

=Sum(IIf(Year(Now())=(Year([Trans-Check Date] - 1)),[Amount],0))
 
Pardon me. I think you have a parens in the wrong place. I read the code as
subtracting one day form the date, instead of one (year) from the year of the
Tran-Check Date field.


=Sum(IIf(Year(Now())-1=Year([Trans-Check Date]),[Amount],0)

Hopefully, I've resolved this correctly.

Douglas J. Steele said:
Without knowing all of the details of what you're doing, what happens if you
add something along the lines of:

=Sum(IIf(Year(Now())=(Year([Trans-Check Date] - 1)),[Amount],0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)

Meryl said:
I am trying to create a report that shows 2 total
donation totals per person side by side - one for the
current year and one for the prior year.

I have the code for the current year, see below, but I
can't figure out how to code it for the prior year. My
underlying query has all the donor transactions.

=Sum(IIf(Year(Now())=Year([Trans-Check Date]),[Amount],0))

Thank you!
 
Good catch, John.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



John Spencer (MVP) said:
Pardon me. I think you have a parens in the wrong place. I read the code as
subtracting one day form the date, instead of one (year) from the year of the
Tran-Check Date field.


=Sum(IIf(Year(Now())-1=Year([Trans-Check Date]),[Amount],0)

Hopefully, I've resolved this correctly.

Douglas J. Steele said:
Without knowing all of the details of what you're doing, what happens if you
add something along the lines of:

=Sum(IIf(Year(Now())=(Year([Trans-Check Date] - 1)),[Amount],0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)

Meryl said:
I am trying to create a report that shows 2 total
donation totals per person side by side - one for the
current year and one for the prior year.

I have the code for the current year, see below, but I
can't figure out how to code it for the prior year. My
underlying query has all the donor transactions.

=Sum(IIf(Year(Now())=Year([Trans-Check Date]),[Amount],0))

Thank you!
 
Back
Top