If using data like in the following example:
Item | Cost | Rank |
---|
ID1 | 30 | 2 |
ID2 | 20 | 4 |
ID3 | 50 | 1 |
ID4 | 10 | 3 |
How can I create a sum / aggr function that adds the cost item by item along the rank up to the limit of 85.
I.e. the sum should stop adding items cost after this limit is reached (in this case it would be ID3=50 + ID1=30, the other items would not be added any more.
If it is not possible with a sum - how can IDs be identified that would fit in the given limit along the sort order "rank"?
Thanks a lot