Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
ALTER.NEXT:

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

SAVE YOUR SPOT
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

Move data if it includes negative values

Highlighted
7 - Meteor

Hi,

 

I want to see how I can move data over to blank coloumn called debit if they include negative values. So I have data that looks like the below. I was everything that is negative to move over to debit column on the same row. 

 

Example:

 

 

Item    Balance        Debit

AB         709.09        

CD         929.00

DS         -312.01

SQ         -2304.01

WS         201.00

 

Outcome 

 

Item    Balance        Debit

AB         709.09        

CD         929.00

DS                           -312.01

SQ                           -2304.01

WS         201.00

Highlighted
12 - Quasar
12 - Quasar

Hey @JamesG2806,

 

You should be able to use a formula tool to update the Debit column using the formula:

if [Balance] < 0 then [Balance] else [Debit] endif

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @JamesG2806 I have mocked a workflow that produces your output. Negative_Values_Example.png

Highlighted
7 - Meteor

hey @cplewis90  thanks for the quick reply, unfortunately when I use this formula I get < is an invalid operator, Any ideas why ? 

Highlighted
12 - Quasar
12 - Quasar

Is your balance field a string or numeric field? A string field would not know how to interpret the <0 aspect of the formula.

 

If it is a string try:

if contains([Balance],"-") then [Balance] else [Debit] endif

Highlighted
Alteryx
Alteryx

It may be because your field data types are not numeric. You can use the select tool to change the data types to doubles and that should solve the issue. Let me know if this works!

Highlighted
7 - Meteor

@cplewis90 Perfect that worked silly mistake thanks for the answers 

Labels