Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

Converting a value to negative based on IF condition

$
0
0

I have 2 fields in my data - "Amount" & "Indicator". Amount has all positive numbers (e.g. 3.2, 0.1, 10 etc.). Indicator has either "credit" or "debit" in it. I need to write an if condition so that the values in the amount field get converted to negative number if the indicator is "credit" and remains positive otherwise. 

 

I tried a code like this

 

IF [indicator]= "credit"
THEN [amount] = (-1)*[amount]
ELSE [amount]=[amount]
ENDIF

 

but this returns me 0 for all debit values and -1 for all credit values. Any suggestions on how to do it correctly?

 

Thanks in advance


Viewing all articles
Browse latest Browse all 4999

Trending Articles