Forum Discussion

TimEgerton1's avatar
TimEgerton1
Qrew Member
3 years ago

Week on Week Sales Comparison using Formula Query

Hi,

We have a sales summary table that has a sales total per week. [Week Ending], FID 6 and [Sales Total], FID7.

We would like to do a week on week sales comparison using a Formula Query (if that is possible)

We have tried various formula queries with this one being the "best" so far.

var text LASTWEEK = "{6.BF.'"& [Week Ending] &"'}";
var text THISWEEK = "{6.AF.'"& [Week Ending] &"'}";

GetRecords($THISWEEK,7)-GetRecords($LASTWEEK,7)

However we are getting the following error;

"The types of the arguments or the number of arguments supplied do not meet the requirements of the function GetRecords.
The function GetRecords can be used with the following arguments:
GetRecords (Text q).
GetRecords (Text q, Text t)."

Any suggestions would be greatly appreciated.

Tim

------------------------------
Tim Egerton
------------------------------

1 Reply

  • Hey Tim,

    I believe you are missing some key elements in your formula.

    All GetRecords does is 'get the records' you still need to tell Quickbase what to do with them (Size, SumValues, or GetFieldValues).

    SumValues(GetRecords($THISWEEK),7)-SumValues(GetRecords($LASTWEEK),7)

    I suggest watching these videos to learn more about the exact syntax:


    ------------------------------
    Quick Base Junkie
    ------------------------------