我有原始数据集
-95
根据收入状况,收入时段是我的预期输出。
我的代码
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
我尝试使用DAX,但并没有帮助我。你能帮我吗?
答案 0 :(得分:0)
首先sum of category
不起作用,因为类别不是数字。算是可行的,但我不确定您想在那里做什么。
如果您想要基于收入列的集群,则可以在dax中像这样添加。首先添加一个新列,并使用以下dax表达式:
= IF('Spend by Client'[Revenue] = 0; "$0"; IF('Spend by Client'[Revenue] < 10; "$1-10"; "More than 10")
您可以根据需要嵌套if的次数,以覆盖更多类别。