Skip to main content
Question

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
------------------------------
This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24
try this change

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

------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------