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

7 replies

null
    • John_Halls
    • 2 yrs ago
    • Reported - view

    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

    • John_Halls
    • 2 yrs ago
    • Reported - view

    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

    • TESTXFREE
    • Bobo
    • 2 yrs 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

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

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

    Steven

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    BINGO!!

    It works
    Many thanks ;-)

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

    • Fred
    • 2 yrs 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°'.

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    Many thanks to all ;-)

Content aside

  • 2 yrs agoLast active
  • 7Replies
  • 579Views