我想将空白值替换为零,为此我在表格模型中创建了一个度量,该度量的定义为:
Test:=if (
calculate (
sum ( quantity ),
flag = 1,
title = "WEEKS"
) = blank (),
0,
calculate (
sum ( quantity ),
flag=1,
title = "WEEKS"
)
)
虽然效果很好,但是当我将此度量拖动到某些尺寸时,它会增加行数。
+-------------+-------------+------+
| Dimension A | Dimension B | Test |
+-------------+-------------+------+
| A | C | 0 |
| B | X | 0 |
| A | X1 | 0 |
| B | X1 | 0 |
| A | G | 0 |
| A | D | 0 |
+-------------+-------------+------+
它增加了像笛卡尔式的行,并且当我删除if条件时,它工作得很好。
+-------------+-------------+------+
| Dimension A | Dimension B | Test |
+-------------+-------------+------+
| A | C | 0 |
| B | X | 270 |
| A | X1 | 101 |
| B | X1 | 44 |
| A | G | 12 |
| A | D | 10 |
+-------------+-------------+------+
那可能是什么原因,我只是想用零替换空白值。
答案 0 :(得分:1)
如果您想将blank()值更改为零,只需在计算末尾添加0:
Test:=
calculate (
sum ( quantity ),
flag = 1,
title = "WEEKS"
) + 0