获取要添加到起始值的金额的公式,因此添加的金额将 = 新总计的 5%

Formula to obtain amount to add to Starting Value so the added amount will = 5% of New Total

有没有在T-SQL中行得通的公式可以得到下面的?

求解 x,其中将 x 添加到起始值,将等于起始值的 105%。

例子 起始值为 380。 将 x 加到 380,使 x 占总数的 5% (380 + x) 在这种情况下,x 是偶数 20。

这不是起始值的 5%,这很简单。在将 x 添加到起始值后,我正在寻找它等于新值的 5%。

谢谢!

I'm looking for x to equal 5% of the new value after it's been added to the starting value.

让我们做一些 9 年级的代数 :) 我什至会展示我的作品。

如果 S 是起始值,我们有这个等式:

x = 0.05 * (S + x)

现在求解x:

x = 0.05S + 0.05x      // distribute the constant

0.95x = 0.05S          // subtract the smaller x term from both sides

x = (0.05 / 0.95) * S  // divide the 0.95 from both sides

x = S / 19             // multiply the right side by 1 (20/20) to simplify

所以我们看到您可以将起始值除以 19 以获得所需的 x 值。


还有另一种解方程的方法,因为我觉得这种事情很好玩:

x = (1/20) * (S + x)   // convert the decimal to a fraction 

x = (S + x) / 20       // reduce/simplify the fraction multiplication

20x = S + x            // multiply both sides by 20, to remove division

19x = S                // subtract the smaller x term from both sides
                       //   (hey, we solved for S along the way)

x = S / 19             // Divide both sides by 19

当两种方法给出相同的解决方案时总是好的 :)。这是更多的步骤,但步骤更简单。