cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplication Sap Analytics cloud

AngelMesp
Explorer
0 Kudos

Hello experts,

Im trying to multiply two measures using advanced formulas in a data action but doesnt work, i cant see any result.

 - first measure: Quantity --> Im saving this measure in a previous step with the following code.

(im saving in all dimensions #)

MEMBERSET [d/Date] = "202501" TO "202512"

DATA([d/Measures]="Quantity",
	          [d/P_COMERCIAL]="#",
	          [d/P_CURRENCY]="#",
	          [d/P_FLAG_PERIODOS]="#",
	          [d/P_PLANT]="#",
                  [d/Date]="203112") = 
RESULTLOOKUP([d/Measures]="KVEN02")

  - second measure: porcentaje --> the final user save this value in a table. As you can see, all the values      are stored in #

AngelMesp_0-1710344758414.png

With this, if i try to save the first value and secondi can successfully. Moreover, i can do an addition or a subtraction and work.

This is my code when i try to multiply

DATA([d/Measures]="Quantity",
                  [d/P_COMERCIAL]="#",
                  [d/P_CURRENCY]="#",
                  [d/P_FLAG_PERIODOS]="#",
                  [d/P_PLANT]="#") =  RESULTLOOKUP([d/Measures]="Porcentaje",									 
                  [d/P_COMERCIAL_CLIENTE]="#",								 
                  [d/P_COMERCIAL]="#",											  
                  [d/P_CURRENCY]="#",											  
                  [d/P_CUSTOMER]="#",										  
                  [d/P_DISTR_CHAN]="#",											  
                  [d/P_FLAG_PERIODOS]="#",											  
                  [d/P_MATERIAL]="#",											  
                  [d/P_PLANT]="#",											  
                  [d/P_REPRESENTANTE]="#", 										  
                  [d/P_SALESUNIT]="#",											  
                  [d/P_ZFAMIAGR]="#",											  
                  [d/P_ZFAMIAGR3]="#") *
RESULTLOOKUP([d/Measures]="Quantity",
	          [d/P_COMERCIAL]="#",
	          [d/P_CURRENCY]="#",
	          [d/P_FLAG_PERIODOS]="#",
	          [d/P_PLANT]="#",
              [d/Date]="203112")

each month have a different value for porcentaje measure

I need multiply Quantity * Porcentaje in the following image, as you can see all 2025 are empty

AngelMesp_1-1710347391993.png

Please help, im really stuck. I've already read another similar questions, for example:

 https://community.sap.com/t5/technology-q-a/sac-advance-formula-not-working-for-division-operation/q...

 https://community.sap.com/t5/technology-q-a/calculation-problem-when-multiplying-resultlookup/qaq-p/...

But i dont know what is my problem.

 

Cheers.

 

 

 

Accepted Solutions (0)

Answers (3)

Answers (3)

AngelMesp
Explorer
0 Kudos

Hi everyone,

Im still stuck, does anyone know how I can do it?

 

please help!!

AngelMesp
Explorer
0 Kudos
Hello,
AngelMesp
Explorer
0 Kudos
Hello, im still stacked 😞
AngelMesp
Explorer
0 Kudos
Hello, im still stacked 😞 can someone help me please
N1kh1l
Active Contributor
0 Kudos

@AngelMesp 

MEMBERSET [d/Date] = "202501" TO "202512"

DATA([d/Measures]="Quantity",
	          [d/P_COMERCIAL]="#",
	          [d/P_CURRENCY]="#",
	          [d/P_FLAG_PERIODOS]="#",
	          [d/P_PLANT]="#",
                  [d/Date]="203112") = 
RESULTLOOKUP([d/Measures]="KVEN02")

In the above code the remaining dimensions will taken from right side of RESULTLOOKUP()

Multiplication and Division work with keys on all dimension members. It means that it will work by matching all dimension values in the record.

The easiest way to make this work is by looking at the data intersection of both Quantity and Percentage in terms of all  dimension. Then while multiplying , mention all the dimension explicitly within RESULTLOOKUP() which do not share common master data value between 2 records. Without seeing you data intersection its pretty tough to say which dimension is not common. Just goto the modeler view of the model and filter 1 record for both quantity and percentage and see which dimensions share common master data and which not.

 

Br.

Nikhil

AngelMesp
Explorer
0 Kudos

@N1kh1l

The user have a table tu store the porcentage value, in this table the only one measure is Country, just because they need apply globally this %(porcentage ) increase over the Quantity measure.

I think, when you save a value in a table with just one dimension, all others are going to be unassigned. That is why im putting # in my data action code when i call porcentage measure.

AngelMesp_0-1710403514136.png

Moreover, the measure quantity have only five unassigned dimensions

 [d/P_PLANT]="#"
 [d/P_COMERCIAL]="#",
 [d/P_COMERCIAL_CLIENTE]="#",
 [d/P_FLAG_PERIODOS]="#",
 [d/P_CURRENCY]="#"

 all others have master data but i cant specify one by one because i need apply this increase by country.

Maybe my approach is wrong or it is not posible to do it in SAC.

What do you think?

Thanks!

N1kh1l
Active Contributor
0 Kudos

@AngelMesp 

Multiplication and Division will only work if you specify all non common dimension members explcitly in the resultlookup(). I would suggest first drill down both Quantity and percentage records in terms of all dimension and then see what dimension values are not common between them and then specify it in the RESULTLOOKUP(). From your example I see you specify more dimensions on percentage side but only few on Quantity.

 

Nikhil

AngelMesp
Explorer
0 Kudos

@nikhil

Thanks for your response.

Sorry for my question, but, what do you mean with

"...if you specify all non common dimension members explcitly in the resultlookup()."


do i have to specify all the dimension that have data for one measure but not for the other?

About your observation, I have just few dimensions for quantity measure because they are the ones i indicating in the previous step, and all of they are "unassigned"  the other dimensions have data.

 

MEMBERSET [d/Date] = "202501" TO "202512"

DATA([d/Measures]="Quantity",
	          [d/P_COMERCIAL]="#",
	          [d/P_CURRENCY]="#",
	          [d/P_FLAG_PERIODOS]="#",
	          [d/P_PLANT]="#",
                  [d/Date]="203112") = 
RESULTLOOKUP([d/Measures]="KVEN02")

for this reason im leaving these dimension

im really lost, sorry.

Thanks