Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Tool to apply a formula when it is NULL

rdelmund
7 - Meteor

Hi All, 

 

Just want to check what tool or script i can use that i can apply a formula on the branch column if its NULL just retain the value if its not NULL. 

 

 

 Sample Picture - Alteryx.PNG

 

Thanks

Rob

6 REPLIES 6
RolandSchubert
16 - Nebula
16 - Nebula

Hi Rob,

 

if you want to repeat the branch in subsequent rows, if they are NULL,
I would recommend to use a Multi Row Formula tool.

Formula would be like:
IF IsNull([Branch]) THEN
    [Row-1:Branch]
ELSE
    [Branch]
ENDIF

 

Is that what you want to do?

 

Best regards

 

Roland

rdelmund
7 - Meteor

Hi Roland, 

 

Actually i will be applying formula for those NULL row that if Counterparty starts with C  or D then Branch = AG SCF. 

 

Can i use the Multirow formula as well?

 

Thanks, 

Rob

RolandSchubert
16 - Nebula
16 - Nebula

I think you should you a Formula tool then.

Formula checks if [Branch] is NULL and sets the field to "AG SCF", if [Counterparty] starts with "C" or "D".

IF ISNull([Branch]) THEN
    IF Left([Counterparty], 1) = "C" THEN
        "AG SCF"
    ELSEIF Left([Counterparty], 1) = "D" THEN
        "AG SCF"
    ELSE
        [Branch]
    ENDIF

ELSE
    [Branch]

ENDIF

 

 

rdelmund
7 - Meteor

Thanks for sparking the Idea i just used the below formula instead and it works for me.

 

IF StartsWith([Counterparty], "C") THEN "AG SCF" ELSEIF StartsWith([Counterparty], "D") THEN "AG SCF" ELSE [Branch] ENDIF

 

no need to put the isnull condition at the start. 

 

 

estherb47
15 - Aurora
15 - Aurora

Hi Rob,

 

Since you only want to apply the formula when the Branch is null, it's important to include that in the formula, just in case other rows have counterparts that begin with C or D.

 

Love the use of StartsWith instead of Left!


IF IsNull([Branch]) THEN
   IF StartsWith([Counterparty], "C") THEN "AG SCF"

   ELSEIF StartsWith([Counterparty], "D") THEN "AG SCF"

   ELSE [Branch]

   ENDIF

ELSE [Branch]

ENDIF

rdelmund
7 - Meteor

Will take note of it. Thanks for the reminder :)

 

Labels