Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
sculptorlv
Creator III
Creator III

IsNull function

Good day!

I can't get the idea why IsNull function dosn't work properly in my LOAD statement.

Help.jpg

When, my SUM has values, I get an adequete result. Still, I can't convert Null data to ZERO values.

Please help!

1 Solution

Accepted Solutions
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Try this work around:

tmp:

LOAD Item_number

,Sum(Quantity_Reserved) as Quantity_Reserved

Resident RESERVED

Group By Item_number

;

NoConcatenate

tmp2:

LOAD Item_number

,If(Len(Trim(Quantity_Reserved)) = 0, 0, Quantity_Reserved) as Quantity_Reserved2

Resident tmp;

DROP Table tmp;

Rename Field Quantity_Reserved2 to Quantity_Reserved;

View solution in original post

8 Replies
tresesco
MVP
MVP

Sum of null values , i.e. Sum(Null()) would give zero itself, isn't it?

sculptorlv
Creator III
Creator III
Author

Unfortunatelly no It would give NULL, thus I would not be able to do mathematical calculations with it.

help2.jpg

YoussefBelloum
Champion
Champion

Hi,

try this

if(len(trim(sum(quantity_reserved))=0,0...

sculptorlv
Creator III
Creator III
Author

Same result

fvelascog72
Partner - Specialist
Partner - Specialist

Hi,

I try this:

Data1:

LOAD

  Item,

  If(Qty = '', null(), Qty) as Qty

INLINE [

Item, Qty

1,

2,

3,

4,

5, 10

6,

7,

];

NoConcatenate

Data2:

LOAD

  Item,

  Sum(Qty) as Qty

Resident Data1

Group by Item

;

DROP Table Data1;

Saludos

tresesco
MVP
MVP

I guess, the problems lies somewhere else. Could you post a sample qvw with sample data ?

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Try this work around:

tmp:

LOAD Item_number

,Sum(Quantity_Reserved) as Quantity_Reserved

Resident RESERVED

Group By Item_number

;

NoConcatenate

tmp2:

LOAD Item_number

,If(Len(Trim(Quantity_Reserved)) = 0, 0, Quantity_Reserved) as Quantity_Reserved2

Resident tmp;

DROP Table tmp;

Rename Field Quantity_Reserved2 to Quantity_Reserved;

sculptorlv
Creator III
Creator III
Author

I don't understand WHY!!! but it works.. thank you!