Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Calculation in Derived Column not correct decimals

$
0
0

Hi!

I am struggling with a calculation problem in a Derived Column. My issue is that I am trying to allocate an aggregated amount to transaction rows with the formula,

Row amount / Sum( Row Amounts) * Aggregated Amount

where

Row Amount is the amount on each row, SUM(Row Amounts)is the aggregation of all transaction row amounts, Aggregated Amount is the amount I want to allocate to the transaction rows. All fields have Numeric(38, 6) datatypes. And the destination field is also Numeric(38, 6)

The formula looks like this in the Derived Column component,

REPLACENULL(Gross_POS_Turnover_SEK_Total,0) == 0 ? 1.0 / NoOfTransactions * BankedSEK_Total : Gross_POS_Turnover_SEK / Gross_POS_Turnover_SEK_Total * BankedSEK_Total

For example 45,828 (Gross_POS_Trunover_SEK) /  1234532,32 (Gross POS Turnover SEK Total)* 1631764,077 (BankedSEK_Total) = 60,573857

However, if I do the same calculation in Excel with the same figure and round to 6 decimals I get60,573938, and with a couple of million rows it adds up an annoying diff.

I have tried to round the result in SSIS but it did not make any difference.

Anyone had a similar problem? 

Regards,

//Patrick


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>