Forum Discussion

RuelYparraguirr's avatar
RuelYparraguirr
Qrew Trainee
5 years ago

Cumulative field

I am looking on how to create a field that will show the running total of a certain field. I saw this https://haversineconsulting.quickbase.com/db/bnab4bvnx?a=q&qid=1&_ga=2.126707979.728167338.1559232320-1369865748.1557428883 and it is the one I'm looking for. But I can't seem to understand how to recreate the Cumulative Sum field. Could someone explain this to me in a simpler way? I'd really appreciate it. 

9 Replies

  • Here is a link to Dan's Code:

    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=614&rl=cgzu

    Doing it this way will give the exact result as shown in the URL you posted. Make a Rich Text Formula Field and use this code:


    "<img src onerror='window.QBU_Sum = (window.QBU_Sum || 0) + " & [YOUR_CERTAIN_FIELD] & ";this.outerHTML=QBU_Sum'>"


    Replace "YOUR_CERTAIN_FIELD" with whatever field you want summed, then in your report, arrange your fields in the same manner as shown in the URL you posted.

    Here is a snip of the duplicated result:

    • RuelYparraguirr's avatar
      RuelYparraguirr
      Qrew Trainee
      Awesome! And is there a way to make the running total by date created? It seems that currently, it is dependent on how the data is sorted. I hope you understand what I mean.
    • JordanMcAlister's avatar
      JordanMcAlister
      Qrew Captain
      Correct, it will be dependent on how you sort your report, which is fine if you have your report sorted by record id or date created, otherwise, the solution may be harder to do.

      I'll reply back if I figure out a good way to have a cumulative field directly tied to the record itself based on record id. 
    • RuelYparraguirr's avatar
      RuelYparraguirr
      Qrew Trainee
      Got it. Thank you for your reply. I appreciate your help. One last thing --- in your screenshot, can we have the 458866 be on top and then down to 0? Like a reverse running total.
  • Lina, are you just trying to create a running total on a report?  If so you can just use a summary report, break on Record ID# or some other unique record identifier and set the field to be a running total down the column.

    You can put the same field on the report twice, once "regular" and once as a running total.