我想了解DAX。我想在Matrix视觉中获得类别Cat1的小计。这是我的表
Cat1 Cat2 Sales
Fruits Apples 30
Fruits Apples 50
Fruits Apples 100
Fruits Cherries 50
Fruits Cherries 80
Vegetables Tomatoes 20
Vegetables Tomatoes 30
Vegetables Tomatoes 10
在下面创建测量后,
Sales running total in Cat1 =
CALCULATE(
SUM('Table1'[Sales]),
FILTER(
ALLSELECTED('Table1'[Cat1]),
ISONORAFTER('Table1'[Cat1], MAX('Table1'[Cat1]), DESC)
我希望只为Cat1显示小计,但它们也适用于Cat2。如果我将Cat1更改为Cat2,Matrix中的结果不会改变。那么在DAX公式中使用Cat1或Cat2的目的是什么?
预期结果的示例:
Cat1 Cat2 Sales
Fruits Apples 30
Fruits Apples 50
Fruits Apples 100
Fruits Cherries 50
Fruits Cherries 80
Total: 310
Vegetables Tomatoes 20
Vegetables Tomatoes 30
Vegetables Tomatoes 10
Total: 60
这就是我得到的:
Cat1 Cat2 Sales
Fruits Apples 30
Fruits Apples 50
Fruits Apples 100
Total: 180
Fruits Cherries 50
Fruits Cherries 80
Total: 110
Total: 310
Vegetables Tomatoes 20
Vegetables Tomatoes 30
Vegetables Tomatoes 10
Total: 60
Total: 60
Total: 370