How to dynamicaly calculate sum of all items?

Comments

9 comments

  • Jure Judež

    so... any clues? This is kinda important to me...

    0
    Comment actions Permalink
  • Rainer Grabowski

    You need a second app with an item to which all items of your Cash Flow app are related. There you can get the number in a calculation field

    var amount = @Sum of amount; // from Cash Flow App
    var date = @all of date
    
    moment(date[date.length-1] > moment(String(date[date.length-2])) ? amount : ""
    

    If date current item > date previous get sum of all amounts or show nothing (or whatever you want)

    0
    Comment actions Permalink
  • Jure Judež

    I'm still stuck with this.

    To clarify, I only need calculation that would do this:

    Item    amount    balance calc
    Item1    100$       100$
    Item2     -50$        50$
    Item3      10$        60$
    

    So what i need is sum of all previous items (or previous item calc + current item amount). Something as basic as this surely is possible, right?

    0
    Comment actions Permalink
  • Andreas Garnæs

    Hi Jure,

    For this to work in Podio, you need to connect the entries manually, e.g. Item2 needs to point to Item1, and Item3 needs to Point to item2. You do this with a relationship field. With this in place, you can use a calculation field like so:

    @Sum of Balance + @Amount
    

    Balance is the name of the calculation field.

    Hope this helps!

    Best,
    Andreas

    0
    Comment actions Permalink
  • Jure Judež

    Hi Andreas,

    @Sum of Balance + @Amount
    

    When I try to select @Sum of ... the calculation field doesn't show up in list. It looks like I cannot reference calculation field from calculation field.

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hello Jure,

    calculation fields can be referenced like all other fields. But on "sum of ..." only normal number fields (incl. money) and calculation fields which are number type show up. Maybe the field you're looking for is text (string) type which you can only get by "all of ..." . If you want to use numbers from a text type calculation field for further calculations you have to parse it to number format first. Or you create a new calculation field (the one you're looking for) as number type.

    Rainer

    0
    Comment actions Permalink
  • Jure Judež

    Oh, right! Thanks Rainer! It would be nice if podio would display the type of calculation field somewhere. I can't get this to work thoguh.

    @Sum of Balance + @Amount won't work because it needs to reference back itself.

    0
    Comment actions Permalink
  • Andreas Garnæs

    If you add the relationship-field as described earlier, it will work. The reference isn't pointing back to itself, but to the previous item in the chain so to speak. If Item2 points to Item1, then evaluating @Sum of Balance + @Amount for Item2 will be equal to 100 + -50, where 100 is the balance from Item1 and -50 is the amount from Item2.

    0
    Comment actions Permalink
  • Jure Judež

    Hi Andreas!

    I must be doing something wrong. Because when I try to enter @Sum of Balance into my "Balance" calculation field it doesn't pop up as an option that I could select from. And I'm pretty sure the calc field is indeed a number field.

    Any ideas?

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk