Skip to Content

There is a common requirement to perform PERIODIC <-> YTD conversion of the data:

  • Copy planning data from PERIODIC model to YTD consolidation model
  • Copy actual data from YTD consolidation model to PERIODIC planning model
  • Special currency conversion
  • Calculation of accounts

The period selection has to be the list of months starting from first month of the year up to some selected month or all months of the year.


Let’s start with PERIODIC -> YTD conversion:

Sample 1: We have data in EXP account in PERIODIC model and we want to convert this data to YTD and store result in the AST account of the same model for all months of the year.

Somebody may think that the following script will do the job:

*XDIM_MEMBERSET ACCOUNT=PL110 //EXP ACCTYPE
*XDIM_MEMBERSET TIME=BAS(2007.TOTAL)
*XDIM_MEMBERSET MEASURES=PERIODIC

*WHEN TIME
*IS *
*REC(EXPRESSION = [MEASURES].[YTD],ACCOUNT=BS111) //BS111 - AST ACCTYPE
*ENDWHEN

The report screenshot will show the issue:

Empty records for BS111 in the periods with empty records for PL110 (no record in WHEN/ENDWHEN loop) – compared to YTD MEASURE for PL110.

To get the correct results (same as YTD MEASURE of PL110) we need a script that will accumulate figures for all periods like:

*XDIM_MEMBERSET ACCOUNT=PL110 //EXP ACCTYPE
*XDIM_MEMBERSET TIME=BAS(2007.TOTAL)
*XDIM_MEMBERSET MEASURES=PERIODIC
*SELECT(%Y%,[YEAR],TIME,[ID]=2007.TOTAL) //%Y% - will contain 2007

*WHEN TIME.MONTHNUM
*IS 1
*REC(EXPRESSION=%VALUE%,TIME=%Y%.01,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.02,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.03,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.04,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.05,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.06,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 2
*REC(EXPRESSION=%VALUE%,TIME=%Y%.02,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.03,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.04,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.05,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.06,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 3
*REC(EXPRESSION=%VALUE%,TIME=%Y%.03,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.04,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.05,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.06,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 4
*REC(EXPRESSION=%VALUE%,TIME=%Y%.04,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.05,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.06,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 5
*REC(EXPRESSION=%VALUE%,TIME=%Y%.05,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.06,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 6
*REC(EXPRESSION=%VALUE%,TIME=%Y%.06,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 7
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 8
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 9
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 10
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 11
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,ACCOUNT=BS111)
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*IS 12
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,ACCOUNT=BS111)
*ENDWHEN

Correct result:

Code performance: code with single WHEN/ENDWHEN loop is significantly faster then code with multiple loops, where each WHEN/ENDWHEN will calculate single target YTD month value:

//Slow code with 12 WHEN/ENDWHEN loops
*XDIM_MEMBERSET ACCOUNT=PL110
*XDIM_MEMBERSET MEASURES=PERIODIC
*SELECT(%Y%,[YEAR],TIME,[ID]=2007.TOTAL)

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09,%Y%.10,%Y%.11,%Y%.12
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.12,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09,%Y%.10,%Y%.11
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.11,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09,%Y%.10
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.10,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.09,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.08,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.07,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.06,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.05,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03,%Y%.04
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.04,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02,%Y%.03
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.03,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01,%Y%.02
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.02,P_ACCOUNT=BS111)
*ENDWHEN

*XDIM_MEMBERSET TIME=%Y%.01
*WHEN TIME
*IS *
*REC(EXPRESSION=%VALUE%,TIME=%Y%.01,P_ACCOUNT=BS111)
*ENDWHEN

In case of huge amounts of data, each WHEN/ENDWHEN loop in the code can be replaced with *RUNALLOCATION (multiple RUNALLOCATION can be faster then single WHEN/ENDWHEN on big data):

*SELECT(%Y%,[YEAR],TIME,[ID]=20007.TOTAL)

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09,%Y%.10,%Y%.11,%Y%.12; WHERE=%Y%.12
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09,%Y%.10,%Y%.11; WHERE=%Y%.11
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09,%Y%.10; WHERE=%Y%.10
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08,%Y%.09; WHERE=%Y%.09
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07,%Y%.08; WHERE=%Y%.08
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06,%Y%.07; WHERE=%Y%.07
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05,%Y%.06; WHERE=%Y%.06
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04,%Y%.05; WHERE=%Y%.05
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03,%Y%.04; WHERE=%Y%.04
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02,%Y%.03; WHERE=%Y%.03
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01,%Y%.02; WHERE=%Y%.02
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM TIME WHAT=%Y%.01; WHERE=%Y%.01
*DIM P_ACCOUNT WHAT=PL110; WHERE=BS111
*ENDALLOCATION

If we want to convert only number of periods (starting from the first month of the year up to some period selected in user prompt) the script will be:

//%TIME_SET% contain user selection of the last month ex.: 2007.05
*SELECT(%Y%,[YEAR],TIME,[ID]=%TIME_SET%)
*SELECT(%TID%,[TIMEID],TIME,[ID]=%TIME_SET%)
*SELECT(%T01%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND CALC=N)
*SELECT(%TID02%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=2)
*SELECT(%T02%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID02% AND CALC=N)
*SELECT(%TID03%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=3)
*SELECT(%T03%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID03% AND CALC=N)
*SELECT(%TID04%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=4)
*SELECT(%T04%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID04% AND CALC=N)
*SELECT(%TID05%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=5)
*SELECT(%T05%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID05% AND CALC=N)
*SELECT(%TID06%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=6)
*SELECT(%T06%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID06% AND CALC=N)
*SELECT(%TID07%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=7)
*SELECT(%T07%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID07% AND CALC=N)
*SELECT(%TID08%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=8)
*SELECT(%T08%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID08% AND CALC=N)
*SELECT(%TID09%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=9)
*SELECT(%T09%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID09% AND CALC=N)
*SELECT(%TID10%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=10)
*SELECT(%T10%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID10% AND CALC=N)
*SELECT(%TID11%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=11)
*SELECT(%T11%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID11% AND CALC=N)
*SELECT(%TID12%,[TIMEID],TIME,YEAR=%Y% AND CALC=N AND MONTHNUM=12)
*SELECT(%T12%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND TIMEID>=%TID12% AND CALC=N)

*XDIM_MEMBERSET ACCOUNT=PL110
*XDIM_MEMBERSET MEASURES=PERIODIC

*WHEN TIME.MONTHNUM
*IS 1
*FOR %M01%=%T01%
*REC(EXPRESSION=%VALUE%,TIME=%M01%,ACCOUNT=BS111)
*NEXT
*IS 2
*FOR %M02%=%T02%
*REC(EXPRESSION=%VALUE%,TIME=%M02%,ACCOUNT=BS111)
*NEXT
*IS 3
*FOR %M03%=%T03%
*REC(EXPRESSION=%VALUE%,TIME=%M03%,ACCOUNT=BS111)
*NEXT
*IS 4
*FOR %M04%=%T04%
*REC(EXPRESSION=%VALUE%,TIME=%M04%,ACCOUNT=BS111)
*NEXT
*IS 5
*FOR %M05%=%T05%
*REC(EXPRESSION=%VALUE%,TIME=%M05%,ACCOUNT=BS111)
*NEXT
*IS 6
*FOR %M06%=%T06%
*REC(EXPRESSION=%VALUE%,TIME=%M06%,ACCOUNT=BS111)
*NEXT
*IS 7
*FOR %M07%=%T07%
*REC(EXPRESSION=%VALUE%,TIME=%M07%,ACCOUNT=BS111)
*NEXT
*IS 8
*FOR %M08%=%T08%
*REC(EXPRESSION=%VALUE%,TIME=%M08%,ACCOUNT=BS111)
*NEXT
*IS 9
*FOR %M09%=%T09%
*REC(EXPRESSION=%VALUE%,TIME=%M09%,ACCOUNT=BS111)
*NEXT
*IS 10
*FOR %M10%=%T10%
*REC(EXPRESSION=%VALUE%,TIME=%M10%,ACCOUNT=BS111)
*NEXT
*IS 11
*FOR %M11%=%T11%
*REC(EXPRESSION=%VALUE%,TIME=%M11%,ACCOUNT=BS111)
*NEXT
*IS 12
*FOR %M12%=%T12%
*REC(EXPRESSION=%VALUE%,TIME=%M12%,ACCOUNT=BS111)
*NEXT
*ENDWHEN

Sample 2: We have data in EXP account in PERIODIC model Planning and we want to convert this data to YTD and store result in the same EXP account of the different YTD model PlanYTD.

In this case the following code will work properly:

*XDIM_MEMBERSET ACCOUNT=PL110 //EXP ACCTYPE
*XDIM_MEMBERSET TIME=BAS(2007.TOTAL)
*XDIM_MEMBERSET MEASURES = YTD //Target model storage type

*DESTINATION_APP = PlanYTD //YTD model

*WHEN TIME
*IS *
*REC(EXPRESSION = %VALUE%)
*ENDWHEN

Correct result in YTD model PlanYTD:

It happens because WHEN/ENDWHEN will loop on YTD measure of model Planning. Different approach compared to Sample1.

To convert only number of periods (starting from the first month of the year up to some period selected in user prompt) the script will be:

//%TIME_SET% contain user selection of the last month ex.: 2007.05
*SELECT(%TID%,[TIMEID],TIME,[ID]=%TIME_SET%) 
*SELECT(%T%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND CALC=N)

*XDIM_MEMBERSET TIME=%T%
*XDIM_MEMBERSET ACCOUNT=PL110 //EXP ACCTYPE
*XDIM_MEMBERSET MEASURES = YTD //Target model storage type

*DESTINATION_APP = PlanYTD //YTD model

*WHEN TIME
*IS *
*REC(EXPRESSION = %VALUE%)
*ENDWHEN

 


Another requirement: YTD -> PERIODIC conversion:

Sample 3: We have data in EXP account (in this case ACCTYPE has no effect – all types are YTD) in YTD model and we want to convert this data to PERIODIC and store result in the EXP account of the same model for all months of the year.

In order to avoid FOR/NEXT loop we have to create a property in TIME dimension like NEXTPER (32 characters) and fill it with member ID’s:

The following script will do the job:

*XDIM_MEMBERSET ACCOUNT=PL110
*XDIM_MEMBERSET TIME=BAS(2007.TOTAL)
*XDIM_MEMBERSET MEASURES = YTD

*WHEN TIME.MONTHNUM
*IS 12
*REC(EXPRESSION = %VALUE%,ACCOUNT=PL120)
*ELSE
*REC(EXPRESSION = %VALUE%,ACCOUNT=PL120)
*REC(EXPRESSION = -%VALUE%,TIME=TIME.NEXTPER,ACCOUNT=PL120)
*ENDWHEN

Result:

To convert only number of periods (starting from the first month of the year up to some period selected in user prompt) the script will be:

//%TIME_SET% contain user selection of the last month ex.: 2007.05
*SELECT(%TID%,[TIMEID],TIME,ID=%TIME_SET%)
*SELECT(%Y%,[YEAR],TIME,ID=%TIME_SET%)
*SELECT(%T%,[ID],TIME,TIMEID<=%TID% AND YEAR=%Y% AND CALC=N)

*XDIM_MEMBERSET TIME=%T%
*XDIM_MEMBERSET ACCOUNT=PL110
*XDIM_MEMBERSET MEASURES = YTD

*WHEN TIME
*IS %TIME_SET%
*REC(EXPRESSION = %VALUE%,ACCOUNT=PL120)
*ELSE
*REC(EXPRESSION = %VALUE%,ACCOUNT=PL120)
*REC(EXPRESSION = -%VALUE%,TIME=TIME.NEXTPER,ACCOUNT=PL120)
*ENDWHEN

Sample 4: We have data in EXP account (in this case ACCTYPE has no effect – all types are YTD) in YTD model PlanYTD and we want to convert this data to PERIODIC and store result in the same EXP account of the different PERIODIC model Planning for all months of the year.

Simple code will work:

*XDIM_MEMBERSET TIME=BAS(2007.TOTAL)
*XDIM_MEMBERSET ACCOUNT=PL110
*XDIM_MEMBERSET MEASURES = PERIODIC

*DESTINATION_APP = Planning

*WHEN TIME
*IS *
*REC(EXPRESSION = %VALUE%)
*ENDWHEN

Result in PERIODIC model Planning:

It happens because WHEN/ENDWHEN will loop on PERIODIC measure of model PlanYTD.

To convert only number of periods (starting from the first month of the year up to some period selected in user prompt) the script will be:

//%TIME_SET% contain user selection of the last month ex.: 2007.05
*SELECT(%TID%,[TIMEID],TIME,[ID]=%TIME_SET%) 
*SELECT(%T%,[ID],TIME,YEAR=%Y% AND TIMEID<=%TID% AND CALC=N)

*XDIM_MEMBERSET TIME=%T%
*XDIM_MEMBERSET ACCOUNT=PL110
*XDIM_MEMBERSET MEASURES = PERIODIC

*DESTINATION_APP = Planning

*WHEN TIME
*IS *
*REC(EXPRESSION = %VALUE%)
*ENDWHEN

Other method to perform PERIODIC <-> YTD conversion is to write Custom Logic badi.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply