我的可视化表中有一个表。
具有以下字段
Level1, Type ID, Group ID, Starting Value, Commission, Sales Amount, Calc Bonus Bonus
1 3 1 €5000 1 €9,838 €98.38
1 3 1 €7500 2 €9,838 €196.75 €196.75
1 3 1 €10000 3 €9,838
1 3 1 €12500 4 €9,838
1 3 1 €15000 5 €9,838
1 3 1 €17500 6 €9,838
1 3 1 €20000 7 €9,838
1 3 2 €20000 1 €119,231 €1,192.31
1 3 2 €40000 2 €119,231 €2,384.63
1 3 2 €60000 3 €119,231 €3,576.94 €3,576.94
我用
BONUS Calc =
SUMX(FILTER('table',
AND ('table'[Type] = 3,
'table1'[Sales Amount] >= 'Table'[Starting Value])),
'table1'[Sales Amount] * 'table'[Commission])
但是我想要的是奖金栏
基本上,我想按级别1,类型ID,组ID进行过滤检查第一个起始值<=销售金额并计算佣金...问题是我对所有起始值<=销售金额进行了计算我只想要第一个。
我以为我可以对我的测量列Bonus Calc进行过滤,但我没有找到解决方法...
我很高兴有人能给我一个线索。 谢谢
Dim Group
Groupkey Group
1 group1
2 group2
3 group3
4 group4
5 group5
Table1
Groupkey SalesAmount
1 €9838
2 €119231
3 €
Table
Level1 ID Level1 GroupKey Group Type ID Type Starting value Comission
1 Lev1 1 group1 1 type1 €5000 1%
1 Lev1 1 group1 1 type1 €7500 2%
1 Lev1 1 group1 1 type1 €10000 3%
1 Lev1 1 group1 1 type1 €12500 4%
1 Lev1 1 group1 1 type1 €15000 5%
1 Lev1 1 group1 1 type1 €17500 6%
1 Lev1 1 group1 1 type1 €20000 7%
1 Lev1 1 group1 2 type1 €20000 1%
1 Lev1 1 group1 2 type1 €40000 2%
1 Lev1 1 group1 2 type1 €60000 3%
答案 0 :(得分:0)
因此,要计算佣金,您需要知道销售价格,并且您需要这样做:
comission =
var sales = SUM(table1[SalesAmount])
RETURN CALCULATE(MAX(table[comission]),
ALL(table[starting value]), table[starting value] <= sales)
要计算您的奖金金额,只需在上一次计算中进行扩展:
bonus =
var sales = SUM(table1[SalesAmount])
var comission = CALCULATE(MAX(table[comission]),
ALL(table[starting value]), table[starting value] <= sales)
Return comission * sales