【问题标题】:How calculate success (in %) related to amount?如何计算与金额相关的成功(百分比)?
【发布时间】:2021-10-08 16:25:20
【问题描述】:

想知道我所有客户之间软件更新广告的成功率(百分比)。

我有以下公式,但我认为有问题(基于初步结果),请参阅:

$success = round((($total_pcs_with_new_version) + (($total_pcs_with_old_version)))/100, 2);

/**

[====== Preliminary result ======]

$total_pcs_with_new_version = 13;
$total_pcs_with_old_version = 23

then result will be:

$success = 0.36%

**/

【问题讨论】:

  • 您希望(thing / total) * 100 获得标准人类可读形式的百分比

标签: php math calculation


【解决方案1】:

你的计算不正确:

$success = round($total_pcs_with_new_version * 100 /
                ($total_pcs_with_new_version + $total_pcs_with_old_version), 2);
  • new * 100 / total
  • 13 * 100 / 36 = 36.11

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多