Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I'm having an issue with using rangesum in the script. Attached is an XLS extract of sample data and in column D I specified desired outcome.
When I use a single sales day my formula works and calculated rangesum works without a problem. However, when I add more days to my dataset, that is when rangesum gets out of whack.
I use:
if(Date= peek('Date', -1), rangesum(Sales, peek('RangeSum'))) as RangeSum
Any idea what I am doing wrong here? Data needs to be arranged from highest sales to lowest, by day.
Thanks!
Hi Deepak,
My main sort criteria are Date and Sales. Sales needs to be sorted in a descending order and for the very last Sales record my AccSum must equal total range sum of Sales for that date.
M
Hi Marko,
"My main sort criteria are Date and Sales. Sales needs to be sorted in a descending order and for the very last Sales record my AccSum must equal total range sum of Sales for that date".
Please can you provide sample data of end result in excel for sub set of data. I'm not following completely...sorry!
Cheers,
DV
Hi Deepak,
I attached qvw in my previous post and created a straight table that will give you data sorted as necessary. If you select 20131109 and export to XLS, do sum of the Sale column and you will get -881.447
I hope this helps.
M
Hi Marko,
In straight table sort the data by Accumulated Sum and you will get the last row as -881.447 which is equal to the Sum of all Sales values. Please check attached file.
Regards,
Jagan.
Your answer is in the right direction. The only problem I have now is that my keys that have 0 for sales do not get accumulated.
I also moved the logic from the script to a chart with rangesum(above(sum(..)),0,rowno())) expression.
If i didn't have randonm blanks in my table this would definitely be the correct answer.
Thank you.
Hi Jagan,
That won't work. I cannot sort by AccSum column as the requirement is to sort primarily by sales figures.
Thanks,
M