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

If + IsNull doesn't work. Why?

left join (Table1)
Load "REF ZL", Wytop1, Wytop2, Wytop3, Wytop4, Wytop5,
if(IsNull(Wytop2)=-1 and IsNull(Wytop3)=-1 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'1',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=-1 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'2',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'3',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=0 and IsNull(Wytop5)=-1,'4',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=0 and IsNull(Wytop5)=0,'5', 
))))) as "HowManyHeats"
Resident Table1;

Only last part works fine. I get:

isnull.PNG

 
 

 

 

 

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

HI 

it doesn't work because when you do a left join if one of the common fields have nulls it doesn't work 

but as you do a resident load 

you can replace it with this part 

Table2:
Load *,
if(IsNull(Wytop2)=-1 and IsNull(Wytop3)=-1 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'1',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=-1 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'2',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'3',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=0 and IsNull(Wytop5)=-1,'4',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=0 and IsNull(Wytop5)=0,'5', 
))))) as "HowManyHeats"
Resident Table1;

drop Table Table1;

View solution in original post

2 Replies
lironbaram
Partner - Master III
Partner - Master III

HI 

it doesn't work because when you do a left join if one of the common fields have nulls it doesn't work 

but as you do a resident load 

you can replace it with this part 

Table2:
Load *,
if(IsNull(Wytop2)=-1 and IsNull(Wytop3)=-1 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'1',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=-1 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'2',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=-1 and IsNull(Wytop5)=-1,'3',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=0 and IsNull(Wytop5)=-1,'4',
if(IsNull(Wytop2)=0 and IsNull(Wytop3)=0 and IsNull(Wytop4)=0 and IsNull(Wytop5)=0,'5', 
))))) as "HowManyHeats"
Resident Table1;

drop Table Table1;
paweln
Contributor III
Contributor III
Author