Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show null values as zero?

How to show null values as zero by script?

Ex: If COMM=NULL then 0 else COMM

1 Solution

Accepted Solutions
sushil353
Master II
Master II

Hi,

Have u tried:

IF(COMM = 'NULL',0,COMM) as FieldName

HTH

Sushil

View solution in original post

11 Replies
sushil353
Master II
Master II

Hi,

Try:

if(isnull(Comm),0,comm) as fieldname

HTH

Sushil

vivek_niti
Partner - Creator
Partner - Creator

Hi,

Try this code

If(IsNull(COMM),0,COMM)

Regards,

Vivek

its_anandrjs

Hi,

You can try with

Load

If(Len(Trim(COMM))=0,0,COMM) as CommField

FRom Source;

And also

Load

If( Isnull(COMM)=-1,0,COMM) as CommField

FRom Source;

Regards

Anand

lironbaram
Partner - Master III
Partner - Master III

you can also use

this command

NullAsValue COMM;

Set NullValue =0 ;

your table load

and then

NullAsNull

Not applicable
Author

Capture.JPG

Not working any of the code.

sushil353
Master II
Master II

Hi,

Have u tried:

IF(COMM = 'NULL',0,COMM) as FieldName

HTH

Sushil

Not applicable
Author

Thank you all.

engishfaque
Specialist III
Specialist III

Dear JJR,

Convert null values to 0 using simple expression,

=Alt(FieldName, '',0)

Kind regards,

Ishfaque Ahmed

its_anandrjs

Hi,

It seems you have to convert 0 to NULL if so assume this example

New:

LOAD COMM,ID,If(Trim(COMM)=0,'NULL',COMM) AS FilterField;

LOAD * Inline [

COMM,ID

NULL,1

NULL,2

NULL,3

0,4

300,5

500,7

1400,7  ];

Regards

Anand