Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculation in the loading script

Hi there,

Probebly a very simple question:

I would like to make calculations in the loading script, but I stumble on fields without values.

Please take a look at the calculation in the script of the attached file.

When there is no value in one of the fields the result of the calculation is empty, which imo is wrong.

How should I make this calculation?

Or is there an easy way to autogenarate '0' when there is no value in a field?

Thanks,

Dennis.

1 Solution

Accepted Solutions
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Dennis,

I would suggest this expression:

If(Not IsNull(Start),Start,0) + If(Not IsNull(Mutatie),Mutatie,0) as Calculation

View solution in original post

4 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Dennis,

I would suggest this expression:

If(Not IsNull(Start),Start,0) + If(Not IsNull(Mutatie),Mutatie,0) as Calculation

Miguel_Angel_Baeyens

Hello Dennis,

You can go to the chart properties, Presentation tab, and set "0" as the Null Symbol instead of the "-" sign. However I don't think this is the best solution. Instead, checking that both fields in the script are not empty and, if they are, assign them a 0, would be harder to code but will return better results:

If(Len(Start) = 0, 0, Start) + If(Len(Mutatie) = 0, 0, Mutatie) AS Calculation

In this case, you have to do this (or use the NullDisplay variable if your ODBC returns nulls) because the "+" operator returns null when one of the values is null. But the Sum() functions returns zero even when some values are null.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Anonymous
Not applicable
Author

Thanks, that works perfect!

Anonymous
Not applicable
Author

Thanks, that works also