Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

JustinDallas
Valued Contributor

Sum behaves weirdly - sample inside

Hello Folks,

While debugging another problem, I ran into something that I was unfamiliar with.  Apparently, if I have a SUM measure, with a condition set to a value that doesn't exist, Qlik will ignore it and sum over the entire field.  For instance.

PayTable:

LOAD *,

Null() AS 'payType'

;

LOAD * Inline

[

'employeeId', 'amount'

    1, 200

    1, 100

    1, 36

]

;

Now as we see, the 'payType' field is null.  But when I have this set analysis in the UI, I am left astonished.

SUM({<payType={'Foo'}>} amount)

SumthingWrong.PNG

Does anyone know why it's summing over everything? when Null() != 'Foo' ?

Any help is greatly appreciated.

1 Reply
christophebraul
Contributor III

Re: Sum behaves weirdly - sample inside

Hi,

Add NullAsValue before your script and it's working fine.

Your field payType must not be surround by ' but " or nothing

NullAsvalue *;

PayTable: 

LOAD *,  

null() AS payType

LOAD * Inline 

'employeeId', 'amount' 

    1, 200 

    1, 100 

    1, 36 

;

Community Browser