cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing members of one dimension using a second mapping model

andreag412
Explorer
0 Kudos
269

Dear Community,
I have a question to ask, is it possible to replace via Data Action one or more members of a dimension using a second model with mapping new member and old member?

Specifically, there would be a first model formed in this way:

DataProductCustomerEntityAccountSell-inPrice
202401DUMMYCLI1SOC1QTY10 
202401DUMMYCLI1SOC1PRICE 20
202401DUMMYCLI2SOC2QTY10 
202401DUMMYCLI2SOC2PRICE 20
202401DUMMYCLI3SOC1QTY10 
202401DUMMYCLI3SOC1PRICE 20
202401ART1CLI1SOC1QTY5 
202401ART1CLI1SOC1PRICE 10
202401ART1CLI2SOC2QTY5 
202401ART1CLI2SOC2PRICE 10
202401ART1CLI3SOC1QTY5 
202401ART1CLI3SOC1PRICE 10
202402DUMMYCLI1SOC1QTY10 
202402DUMMYCLI1SOC1PRICE 10
202402DUMMYCLI2SOC2QTY10 
202402DUMMYCLI2SOC2PRICE 10
202402DUMMYCLI3SOC1QTY10 
202402DUMMYCLI3SOC1PRICE 10

The second model would be formed with a mapping for the product dimension:

DataProductOldProductNewKPITech
202401DUMMYART20
202402DUMMYART20

The desired would be to replace the 'Dummy' product of the first model according to the logic of the mapping proposed in the second model.
The result would then be this:

DataProductCustomerEntityAccountSell-inPrice
202401ART2CLI1SOC1QTY10 
202401ART2CLI1SOC1PRICE 20
202401ART2CLI2SOC2QTY10 
202401ART2CLI2SOC2PRICE 20
202401ART2CLI3SOC1QTY10 
202401ART2CLI3SOC1PRICE 20
202401ART1CLI1SOC1QTY5 
202401ART1CLI1SOC1PRICE 10
202401ART1CLI2SOC2QTY5 
202401ART1CLI2SOC2PRICE 10
202401ART1CLI3SOC1QTY5 
202401ART1CLI3SOC1PRICE 10
202402ART2CLI1SOC1QTY10 
202402ART2CLI1SOC1PRICE 10
202402ART2CLI2SOC2QTY10 
202402ART2CLI2SOC2PRICE 10
202402ART2CLI3SOC1QTY10 
202402ART2CLI3SOC1PRICE 10

I tried a couple of solutions using the MODEL and LINK function, but without success.
I thank anyone who can help

 

View Entire Topic
hartmut_koerner
Product and Topic Expert
Product and Topic Expert

I see no other way than including the ProductNew dimension also in your first model.  Then you can copy over the data from the second model. This is necessary because the LINK function has some limitations. In the mapping table, enter a 1 instead of 0. Then you can multiply with the mapping data and redirect from ProductNew to Product. Also take care that the old data are deleted in case a mapping exists and also consider the case that there exist already some data for the new product:

MODEL [Mod2]
ENDMODEL

VARIABLEMEMBER #Tech1 OF [d/Measures]
VARIABLEMEMBER #Tech2 OF [d/Measures]
VARIABLEMEMBER #Quantity OF [d/Measures]

// Copy over mapping from second model
DATA([d/Measures] = #Tech1, [d/Product] = [Mod2].[d/Product], [d/ProductNew] = [Mod2].[d/ProductNew]) = LINK([Mod2], [d/Version] = "public.Actual", [d/Measures] = "Tech")
// Aggregate to get a list of mapped members
DATA([d/Measures] = #Tech2, [d/ProductNew] = "#") = RESULTLOOKUP([d/Measures] = #Tech1)
// Do mapping by multiplying with 1 a redirect to ProductNew
DATA([d/Measures] = #Quantity, [d/Product] = [d/ProductNew].[p/ID], [d/ProductNew] = "#")
= RESULTLOOKUP([d/Measures] = "Quantity", [d/ProductNew] = "#") * RESULTLOOKUP([d/Measures] = #Tech1)
// Delete in case mapping exists
IF RESULTLOOKUP([d/Measures] = #Tech2) != 0 THEN
	DELETE([d/Measures] = "Quantity")
ENDIF
// Add in case there are already data on the mapped product
DATA([d/Measures] = "Quantity") = RESULTLOOKUP([d/Measures] = "Quantity") + RESULTLOOKUP([d/Measures] = #Quantity)

 

Before Mapping

hartmut_koerner_0-1712589165294.png

After Mapping

hartmut_koerner_1-1712589199359.png

Similar problems are solved in these blogs that inspired me to the solution above:

https://community.sap.com/t5/technology-blogs-by-sap/derivation-in-sap-analytics-cloud-planning-read...

https://community.sap.com/t5/technology-blogs-by-sap/derivation-in-sap-analytics-cloud-planning-adva...