Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Descending Calculation

I am trying to build an expression that will take a series of expression results and give me the sum of the top X results. X will be based on number Y.

For example, take this set of results:

OccurrenceValue
39537118556.10
24570115666.24
3860448317.64
4072931146.74
285345408.67
322922608.14
365821959.76
504631900.01
324611716.10
280011627.92
287771316.53
366471211.20


If number Y was 100,000, I need the expression to return 118,556.10 for X. If number Y was 200,000, I need the expression to return 234,222.34 for X.

I am trying to return the point at which the sum of values (X) fully exhausts a fund (Y). The variance of these numbers (18,556.10 and 34,222.34 respectively in the examples above) is the figure I need. If the calculation does not sort descending as it is processed, the variance will not be correct.

The place I'm getting stuck is in identifying the limit in the sort order as a returned value. If I can find the break point, I can then use that figure to cap the sum or apply some kind of ranking.

Hopefully that made some sense. Any suggestions would be greatly appreciated!!

1 Reply
Not applicable
Author

I may be getting closer, but still can't find a way to have the calculated range accumulate internally. I can use concat to get the range of values returned in descending order, but when I use above to get the accumulating values, they aren't coming in descending order. Any suggestions?