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:
Occurrence
Value
39537
118556.10
24570
115666.24
38604
48317.64
40729
31146.74
28534
5408.67
32292
2608.14
36582
1959.76
50463
1900.01
32461
1716.10
28001
1627.92
28777
1316.53
36647
1211.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!!
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?