Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Replacing a null or 0 value with 1 in an column

sriniprad08
11 - Bolide

Hi Team,

I need help.

i have a column with null and 0 and i need to replace both of them with 1.

can you please help?

 

thanks 

Sri

Col1
NULL
NULL
0
0
3
4 REPLIES 4
Emil_Kos
17 - Castor
17 - Castor

Hi,

 

The IF function that you need to use is 

 

IIF(isnull([Col1]) OR [Col1]=0,1,[Col1])

 

OR alterynativly diffrent syntax 

 

IF isnull([Col1]) OR [Col1]=0 THEN 1 ELSE [Col1] ENDIF

sriniprad08
11 - Bolide

Hi @Emil_Kos ,

 

Thank you so much for the help.

 

Cheers,

Sri

AlexandreBall
5 - Atom

Hey Sri,

 

You can apply a conditional formula with the formula tool.

 

For instance:

 

IF [Col1] = Null()
OR [Col1] = 0
THEN 1
ELSE [Col1]
ENDIF

 

Kind regards,

Alexandre

Emil_Kos
17 - Castor
17 - Castor

Hi @AlexandreBall,

 

Thank you for posting your solution.

 

I didn't know that you can write this condition as [Col1] = Null(). I always written IsNull([Col1]) 😀

Labels