Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everbody,
I'm having a problem with determing the weekly increase in the portfolio turnover. I can get the figure for each week, but i also want to see the result from last week to detemine the delta (increase or decrease).
| Week | Turnover portfolio | last week | Delta |
| 45 | 1000 | ||
| 46 | 1100 | 1000 | 100 |
| 47 | 1050 | 1100 | -50 |
| 48 | 1000 | 1050 | -50 |
| 49 | 1100 | 1000 | 100 |
| 50 | 1150 | 1100 | 50 |
What would be the code for the last week data. The fields i use are Week and sum(Sales) for the turnover.
Hope somebody can help me.
Thanx
Niles
Hi Niles,
I hope, it is not too late ![]()
I have done it like follows: I have load your week and Turnover in an Inline-Table called table1.
table2:
load
week, turnover, week-1 AS pre_week
resident table1;
join load
week - 1 AS pre_week
resident table1;
left join load
week AS pre_week, turnover AS pre_turnover
resident table1;
Then you can sum in an pivot or sum table the turnover, the pre_turnover. For the delta you could use if(sum(pre_turnover) <> 0, Sum(tunrover) - Sum(pre_turnover)).
regards
vicky
Hi Niles,
I hope, it is not too late ![]()
I have done it like follows: I have load your week and Turnover in an Inline-Table called table1.
table2:
load
week, turnover, week-1 AS pre_week
resident table1;
join load
week - 1 AS pre_week
resident table1;
left join load
week AS pre_week, turnover AS pre_turnover
resident table1;
Then you can sum in an pivot or sum table the turnover, the pre_turnover. For the delta you could use if(sum(pre_turnover) <> 0, Sum(tunrover) - Sum(pre_turnover)).
regards
vicky