我有原始数据集
Category Month Revenue Expected Result based on condition Revenue Bucket
A 1 10 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 more than 10
A 2 5 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 more than 10
A 3 2 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 more than 10
B 1 0 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 0
B 2 0 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 0
B 3 0 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 0
C 1 2 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 1-10
C 2 5 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 1-10
C 3 2 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 1-10
D 1 12 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 more than 10
D 2 3 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 more than 10
D 3 2 if(sum of category is 0 then 0, else if sum of category >0 and <10 , then 1-10, else more than 10 more than 10根据收益情况,收益桶是我的预期产出。
我的代码
Revenue_Bucket = if(CALCULATE(SUM('Spend by Client'[Revenue]))=0,"$0",if(CALCULATE(SUM('Spend by Client'[Revenue]))<10,"$1-10","More than 0"))我尝试使用DAX,但它对我没有帮助。你能帮帮我吗?
发布于 2020-01-16 13:26:49
首先,sum of category不起作用,因为类别不是数字的。伯爵可以工作,但我不知道你想在那里做什么。
如果你想要一个基于你的收入列的集群,你可以在dax中像这样添加。首先添加一个新列,并使用以下dax表达式:
= IF('Spend by Client'[Revenue] = 0; "$0"; IF('Spend by Client'[Revenue] < 10; "$1-10"; "More than 10")如果你想覆盖更多的类别,你可以频繁地嵌套if。
https://stackoverflow.com/questions/59762646
复制相似问题