Hi,
I am calculating PROFIT SHARE as a % of Net Profit. This is Net Profit * JV Royalty Expense. (E.g. a 50/50 Joint Venture)
Then I am calculating PARTNER SHARE as a % of PROFIT SHARE (It might be 100% to a single partner, or 40/60 etc.)
Both the Profit Share, and Partner Share are drivers stored on very specific intersections and use a *LOOKUP function to retrieve the value. The reason for using the *LOOKUP function instead of a direct MDX query is that the Entity on which the driver is stored, is in a Property of the Entity and to my knowledge you cannot do this in an MDX statement, only [ENTITY].[ID]..
My question:
Is it possible to use a *FOR loop, to loop through master data (customers), look-up each customer's partner share, and save the result back to their customer ID? I am having problems in dynamically changing the *LOOKUP value for Customer.
I have tried to hard-code the Customer to CUST_US100000 and it works perfect = 50% Profit Share is split again by 50% for each Partner. When I try to make the script dyamically look up each Customer's respective Partner Share, I get zero
Any help would be much apprecaited, specifically Vadim Kalinin!
Nick
This is the script:
*XDIM_MEMBERSET ENTITY AS %ENTITY_LIST% = US1A100021_INP
*SELECT(%BAS_PROFIT_CENTRES%,"[ID]",ENTITY,"[ID] = '%ENTITY_LIST%' AND [ENTITY_TYPE] = 'PROFIT CENTRE'")
// Set up Lookup for Drivers from the Planning Driver Reference Entities
*LOOKUP PLANNING_JV_US
*DIM LOOK_PROFITSHARE:ACCOUNT = "JV_ROYALTY_EXPENSE"
*DIM LOOK_PROFITSHARE:CUSTOMER_ASL_US = "CUSTOMER_INP"
*DIM LOOK_PARTNERSHARE:ACCOUNT = "JV_PARTNER_PROFIT_SHARE"
//*DIM LOOK_PARTNERSHARE:CUSTOMER_ASL_US = CUST_US100000 //If this is hard-coded to a single Customer ID, the output is correct
*DIM LOOK_PARTNERSHARE:CUSTOMER_ASL_US = %ALL_ASLS% // Attempt to make lookup dynamic, but doesn't work
*DIM LOOK_PARTNERSHARE:TIME = "TIME_INP"
*DIM ENTITY = ENTITY.PLAN_DRIVER_REF // Uses Property value
*DIM AUDIT_ID = "INPUT"
*DIM MEASURES = "PERIODIC"
*ENDLOOKUP
// Select Entities and Customers (ASL's)
*SELECT(%JV_DEALS%,"[ID]",SUB_DEAL_US,"[DEAL_TYPE] = 'JV'")
*SELECT(%PLAN_REF_POPULATED%, "[ID]", ENTITY, "[ID] = '%BAS_PROFIT_CENTRES%'" AND "[PLAN_DRIVER_REF]<>''")
*SELECT(%ALL_JV_ASLS%, "[ID]", CUSTOMER_ASL_US, "[ARTIST] = 'JOINT_VENTURE'") // SELECT ONLY JV ASL's
*XDIM_MEMBERSET AUDIT_ID = PP_EXPENSE
*XDIM_MEMBERSET ACCOUNT = BAS(TCOJVSHAR_TOTAL)
*XDIM_MEMBERSET CATEGORY = CURRENT_FORECAST
*XDIM_MEMBERSET ENTITY = %PLAN_REF_POPULATED% // Select only Entities with Plan Driver Reference populated
*XDIM_MEMBERSET SUB_DEAL_US = %JV_DEALS% // Select only JV Deals
*XDIM_MEMBERSET TIME = 2014.JAN
*WHEN AUDIT_ID
*IS PP_EXPENSE
*FOR %LOOP_ASLS% = %ALL_JV_ASLS%
*REC(EXPRESSION = %VALUE% * -1 * LOOKUP(LOOK_PARTNERSHARE),CUSTOMER_ASL_US = %LOOP_ASLS%, ACCOUNT = TCOJVSHAR_CALC, AUDIT_ID = PP_EXPENSE_BY_PARTNER)
*NEXT
*ENDWHEN