Alteryx Formula
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Labels:
- Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, not sure what I'm doing wrong here - ENDIF doesn't work either
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Khristian_Evans I dont think your OR condition is correct in that formula, you can replace or with IN operator like below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Khristian_Evans You are missing the close parenthesis before the AND. You are still also missing the ELSE 0 ENDIF to finish the statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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"
