0

Progressive sum

I have a table with the 12 months of the year (12 records).
Inside I have a numeric field 'field A'.
Is it possible in each month to have a 'field B' field with the progressive sum of the 'field A' field so that if I enter the February record I only see the progressive sum of January + February?

thanks in advance

7replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • I got this to work

    I made a table with 12 records with the fields

    Month Text

    Order Number

    A Number

    B Formula

    B contains the following formula

    let a := Order;
    sum((select Months where Order <= a).A)

     

    Regards John

    Like
  • This doesn't refresh as numbers in A change, so try making B a number and put this in the Trigger after update

    let a := 0;
    for j in (select Months) order by Order do
    a := a + j.A;
    j.(B := a)
    end

    Like
    • Bobo
    • TESTXFREE
    • Bobo
    • 1 yr ago
    • Reported - view

    I honestly cannot understand the application of your code.
    I try to repeat my situation.
    I have a "Months" table which contains 12 records.
    In each record I have:
    - Text field with the name of the 'Month'
    - Numeric field with the number of the month 'Month n °'
    - Numeric field with a 'Budget €'
    I should create a formula field that contains the running total of the 'Budget €' field

    Like
  • let d := this;
    sum((select Months where 'Month n°' <= d.'Month n°').'Budget €')

    Steven

    Like
    • Bobo
    • TESTXFREE
    • Bobo
    • 1 yr ago
    • Reported - view

    BINGO!!

    It works
    Many thanks ;-)

    p.s what is exactly the 'this' function?

    Like
    • Fred
    • Fred
    • 1 yr ago
    • Reported - view

    'this' tells Ninox to get the data of the current record you are on. you can then use any field from that record like Steven did in the second line: d.'Month n°'.

    Like
    • Bobo
    • TESTXFREE
    • Bobo
    • 1 yr ago
    • Reported - view

    Many thanks to all ;-)

    Like
Like Follow
  • 1 yr agoLast active
  • 7Replies
  • 530Views