Forum Discussion

LoriPelzel's avatar
LoriPelzel
Qrew Member
2 years ago

Need help with a formula that is asking for last year

var date datevariable = AdjustYear([WTF],-1);

SumValues(GetRecords("{9.EX.'"& [Distributor] &"'} AND {12.EX.'"& [Manufacturer] &"'} AND {11.OAF.'"& $datevariable &"'} AND \n {11.OBF.'"& [WTF] &"'}"), 159)

So this is saying sum the Year to Date value in field 159 when the Distributor and Manufacture are the same and the Date is last year.

WTF is the date field I'm trying to define as last year?

Something is wrong, it works perfectly when I use this for the current year-to-date total.
var date datevariable = FirstDayOfYear([WTF]);
SumValues(GetRecords("{9.EX.'"& [Distributor] &"'} AND {12.EX.'"& [Manufacturer] &"'} AND {11.OAF.'"& $datevariable &"'} AND \n {11.OBF.'"& [WTF] &"'}"), 159)

Thanks for your help!
Lori

------------------------------
Lori Pelzel
------------------------------

2 Replies

  • try this change

    var date datevariable = AdjustYear(FirstDayOfYear([WTF]),-1);

    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • LoriPelzel's avatar
      LoriPelzel
      Qrew Member
      Thanks for the quick response, I will try it tomorrow at work.
      Lori