Business Rule - Copy data using @ALLOCATE

Hi,

We all sometime have a requirement to copy data from one member to another member of the same dimension. For example, copy the actual month data to the forecast months or copy the parent value to the first child and so on..

We can have many ways to do it today we are going to look at the @ALLOCATE function to acheive the same.

First lets start with simple requirement,

Copying data from parent to all the child (Ent1 to Children of Ent1)

SET UPDATECALC OFF;
FIX (PDT_NA VOLUME  Assump  FY17 Sep @RELATIVE("Ent1",0 ))
    Forecast = @ALLOCATE(#Missing ,@Relative("Ent1",0 ) , "Ent1"->"Forecast", , add);
ENDFIX

Next requirement, copy data to the first child

SET UPDATECALC OFF;
FIX (PDT_NA VOLUME  Assump  FY17 Sep @RELATIVE("Ent1",0 ))
    Forecast = @ALLOCATE(#Missing,
    @MEMBER(@HspNthMbr(@NAME(@Relative("Ent1",0 )), 1 )), "Ent1"->"Forecast", , add);
ENDFIX

Another one copy data to the child with certain UDA

SET UPDATECALC OFF;
FIX (PDT_NA VOLUME  Assump  FY17 Sep @RELATIVE("Ent1",0 ))
    Forecast = @ALLOCATE(#Missing, @RELATIVE("Ent1",0 ) AND @UDA("Entity", "withUDA") , "Ent1"->"Forecast", , add);
ENDFIX

We can combine also have a IF statement before @Allocate to have condition for allocation :)

Viva!! the values are copied and blocks are created without any issues.


Comments are appreciated. 

Comments