Discussions

Expand all | Collapse all

Previous Function in Reports

  • 1.  Previous Function in Reports

    Posted 07-16-2019 19:41
    I need a report formula that calculates the difference between the value of a record and the value of the previous record (based on sequential dates). My field is "Sub A Kwh" and the following numeric formula gives a syntax error and the Previous() or PreviousValue() functions aren't recognized.

    ([Sub A Kwh])-([Sub A Kwh],-1)


  • 2.  RE: Previous Function in Reports

    Posted 07-29-2019 15:37
    This isn't something that's supported in Quick Base's formula structure as the records are not 'self-aware'. If you're trying to calculations to compare data from different date periods (each represented by a single record), you would have to build a 'looping' relationship on that table that would be used to connect the current record to the previous record. The easiest way is to have a date field as your key field for the table. You can then create a formula that would determine the correct date for the "Previous Week" (for example). You would then need a Form Rule that would push the formula's value to the reference field for the relationship when the record is saved. You'd then be able to create lookup/summary fields as necessary and use those in formulas.