Year expression?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • angel e
    New Member
    • Mar 2012
    • 1

    #1

    Year expression?

    MS Access 2003

    Final goal:
    It display the past two full years and current year totals in a crosstab as 2010, 2011, 2012. Next year it should be 2011, 2012 full years, and YTD of 2013 and so on.

    2010 & 2011 will be full year's totals and the current year will be year to date (YTD) totals.

    First I tried this to get the past two years and to date: Between DateAdd("y",2,([TransactionDate])) And Date()
    But I am not getting a result.

    Not sure if that's the way to go or have three separate columns in a query to show PriorYear (2010), LastYear (2011), and YTD (Year to date).
    If so what are the correct expressions?

    Thank you very kindly.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I'm not sure why you're adding two years to the transaction date. It should be between the current year minus two and the current year.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      For the filtering try something like :
      Code:
      [DateField] >= CDate("1/1/" & Year(Date()) - 2)
      [PriorYear] is any value of [DateField] where Year([DateField]) = Year(Date()) - 2.
      [LastYear] is any value of [DateField] where Year([DateField]) = Year(Date()) - 1.
      [YTD] is any value of [DateField] where Year([DateField]) = Year(Date()).

      @Rabbit
      It only made more sense to me because I'd read and deleted the other question posted along similar lines :-(

      Comment

      Working...