PR Bhat Posted October 28, 2021 Share Posted October 28, 2021 I want to add the previous rowAdded valueto preset rowValuefor each row based onSorted Columnin descending order. Also want to sort the columnSorted Columnbefore doing sum because my original table is not sorted with respect toSorted Column. If somebody hs the solution please help with the answer. Sorted Column Value Added value 5 0.35 0.35 4 0.35 0.70 4 0.35 1.05 4 0.35 1.40 4 0.35 1.75 4 0.35 2.10 4 0.35 2.45 4 0.35 2.80 4 0.35 3.15 4 0.35 3.50 4 0.35 3.85 4 0.35 4.20 4 0.35 4.55 4 0.35 4.90 4 0.35 5.25 4 0.35 5.60 4 0.35 5.95 4 0.35 6.30 4 0.35 6.65 4 0.35 7.00 4 0.35 7.35 4 0.35 7.70 4 0.35 8.05 4 0.35 8.40 3 0.35 8.75 3 0.35 9.10 3 0.35 9.45 Link to comment Share on other sites More sharing options...
Fabian Duerr Posted October 30, 2021 Share Posted October 30, 2021 Use the RANK() function to get a continuous order. Let's call this new column [Order] Rank([sorted Column],"ties.method=first","desc")Then use SUM() OVER AllPrevious() to get the cumulative sum Sum([Value]) OVER (AllPrevious([Order])) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now