Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table with missing periods. 200703 and 200709-200710
MONTHSUM:
GRP_FIELD
PERIOD
MONTH_END_VALUE
4248/21
200701
1040
200702
895
200704
750
200705
740
200706
730
200707
710
200708
550
200711
435
200712
315
The result should be a table with all periods and for missing values - add the value of the prior period or prior periods.
200703
200709
200710
First step was to create a table with all periods:
BU_PERIOD:
BUPERIOD
2nd Step to connect the two tables:
TEMP:
LOAD Distinct
GRP_FIELD,
Resident MONTHSUM;
Join(MONTHSUM) LOAD
BUPERIOD as PERIOD
Resident BU_PERIOD;
Drop Table TEMP;
At this step I still miss the periods.
3rd Step: Add missing values in empty fields
RESULT:
NoConcatenate
LOAD *,
if(isnull(MONTH_END_VALUE),peek(MONTH_END_VALUE ), MONTH_END_VALUE) as MS_ENDWERT_KUM_1
Resident MONTHSUM order by GRP_FIELD, PERIOD asc;
Drop Table MONTHSUM;