【问题标题】:DAX formula to calculate bonus or income tax计算奖金或所得税的 DAX 公式
【发布时间】:2021-09-22 07:07:26
【问题描述】:

我正在尝试制定一种计算方法,例如计算所得税。起点始终是赚取的金额,我们将起点称为 NetProfit。 例如,我们以 10 万美元的净利润为例

Taxrate first 60k NetProfit is 40%
Taxrate remaining NetProfit is 70%
The outcome of the measure is amount of Tax
60k x 0.4 = 24k 
40k x 0.7 = 28k 
Total Tax = 52k (24k + 28k)

【问题讨论】:

  • 您能否展示一些示例数据和您的预期输出。
  • 要正确插入代码,您可以将其粘贴到编辑器中并单击{ } 按钮或用三个反引号将其包围。请参考编辑器一侧的格式化帮助。

标签: powerbi dax measure


【解决方案1】:

如果你有如下事实表

| Profit |
|--------|
| 40000  |
| 60000  |
| 100000 |
| 10000  |
| 61000  |

您可以通过以下措施实现总税

total:= SUM('fact'[Profit])

// if you want the subtotal tax with 60:40
totalTax:= 
VAR _1stTaxSlot = 60000
VAR _totalTax =
    IF (
        [total] <= _1stTaxSlot,
        [total] * 0.6,
        ( [total] - _1stTaxSlot ) * 0.4 + _1stTaxSlot * 0.6
    )
RETURN
    _totalTax

//if you want the subtotal level with summation of all calculated tax
totalTax2 :=
VAR _1stTaxSlot = 60000
VAR _totalTax2 =
    SUMX (
        'fact',
        IF (
            'fact'[Profit] <= _1stTaxSlot,
            'fact'[Profit] * 0.6,
            ( ( 'fact'[Profit] - _1stTaxSlot ) * 0.4 ) + ( _1stTaxSlot * 0.6 )
        )
    )
RETURN
    _totalTax2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-06
    • 1970-01-01
    • 1970-01-01
    • 2016-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多