Alteryx Designer Desktop Discussions

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

Need help to code a condition

mandarhondule
5 - Atom

Hello,

I need to add comment based on below condition for all the account, can someone please help me with the Conditional code to make it possible, appreciate your help.

 

Example: 

For account 123 account if the amount is in negative and bucket is A1 and for the same account if B2 buckets Balance has amount greater then A1 Bucket amount, then need to make a comment in front of it as show in the O/P table

 

The condition we will be checking is for only A1 and B2 bucket, C3 doesn't need any action.

InPut:

AccAmountBucketBalance
123-52A10
123250B2200
123300C30
456300A1700
456-433B20
456100C30
789100A110
789200B2500
789300C3500
1001-167A10
1001250B2100
1001300C30

 

Output:

 

AccAmountBucketBalanceComment
123-52A10B2 has sufficient balance
123250B2200B2 has sufficient balance
123300C30NO action
456300A1700A1 has sufficient balance
456-433B20A1 has sufficient balance
456100C30NO action
789100A110NO action
789200B2500NO action
789300C3500NO action
1001-167A10B2 doesn't have sufficient balance
1001250B2100B2 doesn't have sufficient balance
1001300C30NO action
2 REPLIES 2
mst3k
11 - Bolide

you want a multi-row formula tool to look at the value in the preceding row, and you want to group by account so that it restarts with each account number. i'm not totally clear on the rule you're trying to apply, but a multi-row formula tool would do it. you'll need a lot of IF statements to cover all your scenarios

chukleswk
11 - Bolide

The following flow will give you the exact output that you want.

 

  1. Because you take no action on C3 regardless of the other buckets, you can filter that out and create your comment for those automatically.
  2. From there, you could filter out all of the negative Amounts, join those back on the positive amounts and check to see if the Balance in the positive Bucket has enough to cover the negative bucket and use a formula to create the desired comment.
  3. Anything that doesn't match between the positive and negative buckets is assumed to have 2 positive Amounts and is assigned a comment of "NO action"
Labels