1
votes

I want to replace blank values with zero, for this i have created a measure in tabular model, the definition of that measure is :

Test:=if (
    calculate (
        sum ( quantity ),
        flag = 1, 
        title = "WEEKS"
    ) = blank (),
    0,
    calculate ( 
        sum ( quantity ),
        flag=1, 
        title = "WEEKS" 
    )
)

Although it works fine, but when i drag this measure with some dimensions it increases the number of rows.

+-------------+-------------+------+
| Dimension A | Dimension B | Test |
+-------------+-------------+------+
| A           | C           |    0 |
| B           | X           |    0 |
| A           | X1          |    0 |
| B           | X1          |    0 |
| A           | G           |    0 |
| A           | D           |    0 |
+-------------+-------------+------+

It increase the rows like, there is a Cartesian, and when i remove the if condition it just works fine.

+-------------+-------------+------+
| Dimension A | Dimension B | Test |
+-------------+-------------+------+
| A           | C           |    0 |
| B           | X           |  270 |
| A           | X1          |  101 |
| B           | X1          |   44 |
| A           | G           |   12 |
| A           | D           |   10 |
+-------------+-------------+------+

So what could be the reason, I simply want to replace blank values with zero.

1
BLANK values are suppressed in the visualisation. Zero values are displayed.Olly

1 Answers

2
votes

If you want to change blank() values with zero, just add a 0 at the end of you calculate:

Test:=
calculate (
    sum ( quantity ),
    flag = 1, 
    title = "WEEKS"
) + 0