LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  operation between rows

    Employee
    Posted 07-03-2014 03:00

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dialpemo

    Is there a way of doing calculation between rows, for example if I have the following field and values:

    field1
    13
    254
    3543
    354435
    3453

    and I want to subtract the value of row 1 of row 2 and divide it by the value of row 1 to calculate the percentage increase/decrease

    Thank you


  • 2.  RE: operation between rows

    Employee
    Posted 07-03-2014 08:02

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ltolleson

    Put the code below in a filter node. You might need to play around with the percentDiff calculation, but you get the idea. The key is setting a variable after the emit to save the value from the previous record.


    if firstExec then
    {
    tempValue = 'field1'
    percentDiff = null
    }


    if not(firstExec) then
    percentDiff = ((('field1' - tempValue) / 'field1') * 100).round(-2)


    emit *, tempValue, percentDiff


    tempValue = 'field1'


  • 3.  RE: operation between rows

    Employee
    Posted 07-08-2014 08:26

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dialpemo

    Dear Larry,

    It was what I just needed thank you.