Alteryx Designer Desktop Discussions

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

Alteryx Formula

Khristian_Evans
7 - Meteor

Hi, I want this formula to pick up on Charge type and State and if the following parameters are met to SUM everything after the word THEN. Can anyone help with correcting formula 

eaa4499f-e72a-4be7-9db9-ff46f78fbc4b.jpg

11 REPLIES 11
cjaneczko
13 - Pulsar

Did you add and ELSE and ENDIF to the end of your formula? The way its written, its not complete. Also you have it set to V_WString. Should it be Double instead?

Khristian_Evans
7 - Meteor

Yes, not sure what I'm doing wrong here - ENDIF doesn't work either

2b2608f3-7bee-47da-8c0f-12f81f83add6.jpg

cjaneczko
13 - Pulsar

What is after your ELSE?  It should be something like ELSE 0 ENDIF. If its still not working, make sure all of the fields you are adding together are all DOUBLE before the formula. 

binuacs
20 - Arcturus

@Khristian_Evans I dont think your OR condition is correct in that formula, you can replace or with IN operator like below

image.png

Khristian_Evans
7 - Meteor
 
 
 

df0dc467-e907-47fd-ba10-5635d04105f1.jpg

 IF [CHARGE_TYPE] IN ('Early Termination Fee', 'Refund Adjustmnet','Account Change Charge', 'Account Change Charge_TE' , 'Late Fee' , 'Past Due Interest' , 'Past Due Interest_PA_1.5' , 'Energy ADJUSTMENT' AND [State] = 'PA'
THEN
[USAGE_CHARGE_AMT] + [LINE_LOSS_CHARGE_AMT] + [OTHER_CHARGE_AMT] + [DEFERRED_AMT] + [BUDGET_CHARGE_AMT] + [GRT_TAXES] 

apathetichell
18 - Pollux

@Khristian_Evans - watch the videos - they'll help identify this kind of thing. Alteryx if statements follow an:

IF 

THEN

ELSE

ENDIF logic. They need at least those four parts. You should figure out what you want in the null case (null would be fine) - but you need to have something in the ELSE statement.

binuacs
20 - Arcturus

@Khristian_Evans 

IF [CHARGE_TYPE] IN ('Early Termination Fee', 'Refund Adjustment', 'Account Change Charge', 'Account Change Charge_TE', 'Late Fee', 'Past Due Interest', 'Past Due Interest_PA_1.5', 'Energy ADJUSTMENT') AND [State] = 'PA'
THEN [USAGE_CHARGE_AMT] + [LINE_LOSS_CHARGE_AMT] + [OTHER_CHARGE_AMT] + [DEFERRED_AMT] + [BUDGET_CHARGE_AMT] + [GRT_TAXES]
ELSE 0
ENDIF
cjaneczko
13 - Pulsar

@Khristian_Evans  You are missing the close parenthesis before the AND. You are still also missing the ELSE 0 ENDIF to finish the statement. 

Khristian_Evans
7 - Meteor

Thank you that solved issue, now I have another unfortunately. The values are outputting for "PA" state but any other state is returning null value would you know how to fix this? I would this the last part of formula after ELSE would include anything not "PA"

427059be-7837-42c9-b045-461bd0b6ec21.png

Labels