cancel
Showing results for 
Search instead for 
Did you mean: 

Copy Measures across hierarchies member using Advanced Formulas (Data Action)

savik
Explorer
0 Kudos
455

Hello SAP experts, 

I'm new to Data Action in SAC Planning, and in these days I faced a requirement that can't figure it out.

The goal: Copy a the value of two measures (let's say VALUE and PERCENTAGE) whose are in the combination of specified dimensions.

Dimensions in scope are:

  • Account
  • Product
  • Plant
  • Entity
  • Owner
  • Flow

This is an example that I can use as a starting point, from which I want to copy VALUE and PERCENTAGE:

ACCOUNTPRODUCTPLANTENTITYOWNERFLOWVALUEPERCENTAGE
C010101TESTPP01ENT01SPA#100,001,2
C010102TEST-2PP01ENT02FRA#4600.008.00
C010102TESTPP01ENT02FRA#1200.003.00
C010103TESTPP03ENT03POR#560.001.40
C010101TESTPP01ENT01SPA01.010.000.00
C010101TESTPP01ENT02FRA65.010.000.00
C010101TESTPP01ENT01SPA55.010.000.00
C010102TEST-2PP01ENT02FRA55.020.000.00
C010102TESTPP01ENT02FRA55.020.000.00
C010103TESTPP03ENT03POR48.010.000.00
C010103TESTPP03ENT03POR66.010.000.00
C010103TESTPP03ENT03POR77.010.000.00

And this is the result I'd like to obtain:

ACCOUNTPRODUCTPLANTENTITYOWNERFLOWVALUEPERCENTAGE
C010101TESTPP01ENT01SPA#100,001,2
C010102TEST-2PP01ENT02FRA#46008
C010102TESTPP01ENT02FRA#12003
C010103TESTPP03ENT03POR#5601.4
C010101TESTPP01ENT01SPA01.01100,001,2
C010101TESTPP01ENT02FRA65.011200.003.00
C010101TESTPP01ENT01SPA55.01100,001,2
C010102TEST-2PP01ENT02FRA55.024600.008.00
C010102TESTPP01ENT02FRA55.021200.003.00
C010103TESTPP03ENT03POR48.01560.001.40
C010103TESTPP03ENT03POR66.01560.001.40
C010103TESTPP03ENT03POR77.01560.001.40
  

So I basically need to copy measures from a Flow = # to other Flow "valorized" with != # in the combination (as shown in the table above).

I've tried many approaches, this is my last attempt (with less dimensions in the combo):

 

 

MEMBERSET [d/Account] = ("C010101", "C010102", "C010103", "C010104")

VARIABLEMEMBER #Account OF [d/Account]
VARIABLEMEMBER #Flow OF [d/Flow]
VARIABLEMEMBER #Owner OF [d/Owner]
VARIABLEMEMBER #Entity OF [d/Entity]

DATA([d/Flow] = #Flow) = RESULTLOOKUP([d/Flow] = "#")

// In my attempts i tried also with FOREACH but i guess it's not necessary
IF RESULTLOOKUP([d/Flow] = #Flow, [d/Measures] = "VALUE") != NULL THEN // tried also with != 0 and 1-1

DATA([d/Flow] = #Flow,
     [d/Entity] = #Entity,
     [d/Owner] = #Owner,
     [d/Measures] = "VALUE") = RESULTLOOKUP( [d/Flow] = "#",
                                             [d/Entity] = #Entity,
                                             [d/Owner] = #Owner,
                                             [d/Measures] = "VALUE")
ENDIF

IF RESULTLOOKUP([d/Flow] = #Flow, [d/Measures] = "PERCENTAGE") != NULL THEN

DATA([d/Measures] = "PERCENTAGE") = RESULTLOOKUP(
                                                 [d/Flow] = "#",
                                                 [d/Entity] = #Entity,
                                                 [d/Owner] = #Owner,
                                                 [d/Measures] = "PERCENTAGE")

ENDIF

 

 

I can write value but to all Flows, not only to the "scoped" ones.

Any guess? I'll appreciate any help.

Thank you very much.

 

Edits:

# 1 - Extended source and target samples 
# 2 - Fixed target table values

View Entire Topic
savik
Explorer
0 Kudos

Hi @MoonJun, thank you for the reply. 

1. Yes,  data should be copied into the red squares as in the example (my bad, i fixed in the original post)

2. I'm not sure i understood, sorry. Would you mind to show me more specifically the point?

I want to give more info, trying to be more precise\clear and summarize the logic.

The formula must "iterate" every row for the combination of dimensions with Flow = "#",  then copy the measures values into the same combination but with Flow NOT EQUAL to "#"  - which are dynamic, different for every combination of Account-Product-Entity-Owner. 

Thanks again for your help.

MoonJun
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @savik

Please refer to the script below to get your expected result.

In my point of view, the Account member is not mapped to the Target scope, so the VARIABLEMEMBER script is added to ignore Account member dimensionality.

MEMBERSET [d/Measures] = "PERCENTAGE"
MEMBERSET [d/Account] = ("C010101", "C010102", "C010103", "C010104")
MEMBERSET [d/FLOW] != "#"

VARIABLEMEMBER #Account OF [d/Account]
DATA([d/Account] = #Account, [d/FLOW] = "#") = RESULTLOOKUP([d/FLOW] = "#")

IF RESULTLOOKUP() != Null THEN
	DATA() = RESULTLOOKUP([d/Account] = #Account, [d/FLOW] = "#")
ENDIF

 

I hope this is helpful to you, and if I have misunderstood anything, please feel free to reach out.

Moonjun