Hello!
I have a SQL query that's pulling data In-DB and I'm trying to manipulate that data using the Formula In-DB tool. I'm trying to check if the line is a Negative Debit or Positive Credit and if so, multiply by -1. This is what I have but I'm getting a syntax error:
IF [RecordType]=C AND [Sum_Amount]>0
THEN (-1)*[Sum_Amount]
ELSEIF [RecordType]=D AND [Sum_Amount]<0
THEN (-1)*[Sum_Amount]
ELSE [Sum_Amount]
ENDIF
I've been trying to figure this out for longer than I'm willing to admit and I have no clue what to try next. I built the formula above partly based off the solution I found in this link:
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Converting-a-value-to-negative-based-on-IF-condition/td-p/48441