Calculations within Grids

Answered

Comments

4 comments

  • Avatar
    Chip Phillips, Community Manager

    Howdy Rachel,

    That's a good question! There isn't a direct way to pull a data from a previous row in a grid for calculation in subsequent rows. However, there is a potential workaround for your scenario using Calculations fields within a Loop screen, as well as a Summary field after the Loop.

    User Nathan H. has shared a workaround for a similar use case in this post.

    If you have questions regarding the potential solution linked above, or further questions on this matter, feel free to share them in a reply. You can also reach out to our Support team for troubleshooting needs by submitting a ticket.

    1
    Comment actions Permalink
  • Avatar
    Rachel Solly

    Chip,

    Thank you for your response.

    It looks like the other case is totaling all field values from the loop screen.  In my case, I need each row within the loop screen to calculate the difference in miles from the previous row. See the screenshot for an example.

     

     

    Let me know if you still think the workaround would apply to my case.

     

    Thank you,

    Rachel

     

    0
    Comment actions Permalink
  • Avatar
    Chip Phillips, Community Manager

    Howdy Rachel,

    Thank you for the screenshot you provided! Since we can't directly pull a data from a previous row in a grid for calculation in subsequent rows, a potential workaround would be to set up three fields (or columns) for each row:

    • 2 Odometer Reading fields, 'Initial Reading' and 'Secondary Reading' (or whatever nomenclature works for your purposes)
    • 1 Calculation field ('Total Miles') to subtract 'Secondary Reading' from 'Initial Reading', thus giving you the Total Miles for that particular row

    Using the screenshot you provided as an example, the first row would have 0 as the 'Initial Reading' and 500 as the 'Secondary Reading', with a Total Miles of 500.

    The second row would have 500 as the 'Initial Reading' and 1000 as the 'Secondary Reading', with a Total Miles of 500, and so on.

    That way, each row would have the Total Miles for the particular trip, and these values could be totaled at the end using a Summary field.

     

    1
    Comment actions Permalink
  • Avatar
    Rachel Solly

    Thanks Chip!

    1
    Comment actions Permalink

Please sign in to leave a comment.