cancel
Showing results for 
Search instead for 
Did you mean: 

Query on calculation context

jino_jose
Active Participant
0 Kudos


Hi Team,

In my inventory cube the stock values are stored at plant level  and the stock quantities are stored at plant and storage location or at plant level. The column P1/Not assigned indicates that there is no storage location available for that record.

The data set will look like below

plant storage locationMaterialstock valuestock qty
P1P1/Not assignedMat11257.340
P1P1/Not assignedMat27361.31
P1P1/Not assignedMat313.480
P1P1/Not assignedMat4377.90
P1P1/Not assignedMat5273.50
P1P1/C01Mat3030
P1P1/C01Mat500
P1P1/C03Mat101
P1P1/C03Mat4041
P1P1/C07Mat506

The expected output  looking at webi level is

Plantstorage locationTotal stock valuetotal stock qty
P1P1/not assigned7361.31
P1P1/C0113.4830
P1P1/C031635.2442
P1P1/C07273.56

To achieve above result I tried to calculate the unit price for each material then multiply with the quantity

The formula I  used to calculate unit price is  (stock value in (plant,material)/ stock qty in(plant,material))

Total stock value = stock qty * unit price , When used this formula on the block I am getting the total stock value as 9286.53 which is the total stock value for the entire plant. Where as I am trying to calculate the total value for each plant and storage location level.

Can anybody give some input on the calculation context can be used to get the above result.

Thanks,

Jo.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Can you explain how you come to the numbers in the expected output.. to me the expected output does not looks correct..

jino_jose
Active Participant
0 Kudos

Hi Mishra,

I think the storage location P1/Not assigned might have confused you. The webi is created on top of a bex query and storage location is compound attribute with plant so if there is no value the bex query returns the field as not assigned.

Consider the P1/C01, the expected output for  P1/C01  the stock value is 13.48  and qty is 30. P1/C01 holds to material MAT3 and MAT5 with quantity 30 and 0 respectively , so the total stock will be 0+30 = 30. The stock value for MAT3 and MAT5 has to be take from P1/not assigned.  the value for MAT3 is 13.48 and the value for MAT5 is 273.5  The total value will be 1*13.5 + 0*273.5 = 13.5

Hope it clarifies

Thanks,

Jo.

Former Member
0 Kudos

I will suggest to get the data for each part into same record to make the calculation easier..

You will have to build two queries.. one with plant , storage loc , material and stock value in one query..

And part and stock quantity into another...

Once these two queries are setup just merge the query on material dimension which will give you the values in the same record and then you can have the formulas which will work for you..