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

replacing zero with null values

Hello

   I have a field which contains the zero values and null values. I need to replace both null to zero and zero to null. Is this possible.

Thanks

Sriram

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

     Try this way.

     Load

               if(isnull(Field1),0,Field1) as Field1,

               if(Field2 = 0, null(),Field2) as Field2

     From xyz;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ssriramin19
Contributor III
Contributor III
Author

is it not possible to write the expression in the front end itself.Also both field 1 and field 2 si same  field . There is only field which changes needs to be done...

Thanks

Sriram

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Yes this expressions are for script only.

     Why dont you change that in script.

Regards,

Kaushik Solanki    

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ssriramin19
Contributor III
Contributor III
Author

In my case both field 1  and field 2 refers to same field .Whether this can be done.?

Thanks

Sriram

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Yes you can do it, even though they are same field.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable

Hi,

Kaushik.solanki shows clearly indicate the solution. Therefore u can use the following to solve your problem.

     Load

               if(isnull(Field1),0, if(Field1=0,null(),Field1) as Field1

     From xyz;

Regards

ssriramin19
Contributor III
Contributor III
Author

Thanks very much...