Calculated Attribute (Sum List minus Object Attribute)

2
Hello I have two entities: 1.  Item 2. Transactions Many transactions to an Item. I’m trying to setup a calculated attribute in items, which sums a decimal attribute for all associated transactions then minus a decimal attribute in items   So far, I have a Microflow which creates a list of transactions and sums the decimal but i cannot work out how to minus the items attribute.  
asked
4 answers
2

As you didn't include a screenshot, I'll assume you have something like this (but with your own entity rather than the Week entity that I used):

 

 

Now you want to subtract something, you can simply use a change variable (or you may have to parse your int into a decimal first in a new variable, let me know if you need help with that):

 

In addition to the above, if you can, avoid using a calculated attribute. It's advisable to make it a stored variable instead and update it whenever one of the objects that should be counted in the attribute changes. This leads to better performance as the attribute is only calculated when needed, and not every time it's shown.

answered
0

Thanks – I’m struggling to get the list without having to get all transactions then filtering on Item attribute.

If I use a “Retrieve” object and retrieve my associated data I get an object instead of a list?

Also – I’ll take note of your calculated field tip – thanks.

answered
0

Feedback noted (and appreciated) – this makes sense.

Would you have an example of your explanation? I’m missing how I can use Aggregate List function if the retrieve by association is not generating me a list?

 

answered
0

Ah my error – that’s correct I had this the wrong way round – should be 1 item to many transactions.

The change variable works perfectly now. Thanks for your help (and your tips) 

answered