cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How do I transfer values between key figures without causing rounding issues?

ptopolewski
Explorer
0 Kudos
353

Dear SAC Community,

We want to transfer values from Key Figure A with 7 decimal places to Key Figure B with 2 decimal places. Copying the data between these key figures leads to rounding errors. The data needs to be copied to Key Figure with 2 dec. places as we have to export the data to table ACDOCP in our S4 System in which the key figures are restricted to two dec. places. How can we transfer the values from key figure A to keyfigure B without getting rounding errors?

In addition, I will give you a more detailed example. In our scenario we want to distribute 5.000 equally with a 50% share to two Order numbers. In our planning story, we enter 5.000 on year 2026 and the value gets automatically allocated to the underlying periods. Here we use Key Figure A with 7 decimal places

 

OrderSumJanFebMarAprMayJunJulAugSepOctNovDec
#5000416,6666667416,66666676667416,6666667416,6666667416,6666667416,6666667416,6666667416,6666667416,6666667416,6666667416,6666667416,6666667

Now we perform the allocation with a 50% per Order nr. The 7 decimals come in handy as we won't face any rounding issues when performing the allocation.

 

OrderSumJanFebMarAprMayJunJulAugSepOctNovDec
Order12500208,315208,335208,335208,335208,335208,335208,335208,335208,335208,335208,335208,335
Order22500208,315208,335208,335208,335208,335208,335208,335208,335208,335208,335208,335208,335

In order to prepare the data for the S4 ACDOCP export, we move the values from key figure A to key figure B via a data action, which results in rounding errors.

OrderSumJanFebMarAprMayJunJulAugSepOctNovDec
Order12.499,94208,31208,33208,33208,33208,33208,33208,33208,33208,33208,33208,33208,33
Order22.499,94208,31208,33208,33208,33208,33208,33208,33208,33208,33208,33208,33208,33

Best regards

Pascal

Accepted Solutions (0)

Answers (1)

Answers (1)

spurwar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Try creating the below calculated measures or write a data action to convert the numbers from 7 decimal places to 2 decimal places. 


Below is a rough way to convert the data using calculated measures and can be optimised further.

 

Measure IDMeasure DescFormula
AmountOriginal Amount(7 decimal places)  
Amount_RoundAmount_RoundFLOOR([Amount]*100 )/100
Amount_ResidueAmount_Residue( [Amount]-[Amount_Round])
MonthDerive Month from Month desciptionIF([d/Period].[p/MONTHDESC] = "Jan", 1,
IF([d/Period].[p/MONTHDESC] = "Feb", 2,
IF([d/Period].[p/MONTHDESC] = "Mar", 3,
IF([d/Period].[p/MONTHDESC] = "Apr", 4,
IF([d/Period].[p/MONTHDESC] = "May", 5,
IF([d/Period].[p/MONTHDESC] = "Jun", 6,
IF([d/Period].[p/MONTHDESC] = "Jul", 7,
IF([d/Period].[p/MONTHDESC] = "Aug", 8,
IF([d/Period].[p/MONTHDESC] = "Sep", 9,
IF([d/Period].[p/MONTHDESC] = "Oct", 10,
IF([d/Period].[p/MONTHDESC] = "Nov", 11,
IF([d/Period].[p/MONTHDESC] = "Dec", 12, 0
))))))))))))
Amount_adjAdjustmnet to be postedIF([Month] <= ROUND(SUBTOTAL([Amount_Residue],[d/Period])/0.01,0), 0.01, 0)
Amount_S4Amount_S4 ( 2 decimal places)[Amount_Round]+[Amount_adj]

Example:

 TotalJanFebMarAprMayJunJulAugSepOctNovDec
Amount5000416.6667416.6667416.6667416.6667416.6667416.6667416.6667416.6667416.6666416.6666416.6666416.6666
Amount_Round4999.92416.66416.66416.66416.66416.66416.66416.66416.66416.66416.66416.66416.66
Amount_Residue0.080.00670020.00670020.00670020.00670020.00669990.00669990.00669990.00669990.00659990.00659990.00659990.0065999
Month 123456789101112
Amount_adj 0.010.010.010.010.010.010.010.010000
Amount_S45000416.67416.67416.67416.67416.67416.67416.67416.67416.66416.66416.66416.66
ptopolewski
Explorer
0 Kudos

please delete this comment

ptopolewski
Explorer
0 Kudos

please delete this comment

ptopolewski
Explorer
0 Kudos

please delete this comment