We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Compare and Flag both Pairs based on Multiple Criteria

bleu
8 - Asteroid

I need help with this one, I'm going in circles.

I need to compare two rows (they're already paired up with a multi row formula)

 

The criteria is:
- If the pair has an Apple in it, the Apple should ALWAYS be sent, the other fruit should NOT be sent
- If the SAME fruit is in a pair (even it's an Apple), only one should be sent

- For fruit other than Apples it's OK if both are not sent

- I need the output to show both pairs like in the desired output below

 

DateUnique IDSentItemPairDesired Output
11/27/22 12:00 AM13543YesBlueberries1Error- Apples should be sent- NOT Blueberries
11/27/22 12:00 AM56765NoApples1Error- Apples should be sent- NOT Blueberries
11/27/22 12:08 AM86543YesGrapes2OK
11/27/22 12:08 AM26354NoPeaches2OK
11/27/22 12:12 AM57345YesApples3Error- Two Apples sent
11/27/22 12:12 AM67676YesApples3Error- Two Apples sent
11/27/22 12:14 AM87657YesPineapples4OK
11/27/22 12:14 AM85756NoLemon4OK
11/27/22 12:15 AM76577NoOrange5OK
11/27/22 12:15 AM45466NoBananas5OK
11/27/22 12:16 AM65465YesApples6OK
11/27/22 12:16 AM87676NoOrange6OK
11/27/22 12:16 AM46546NoApples7Error- Apples should be sent- NOT Grapes
11/27/22 12:16 AM57756YesGrapes7Error- Apples should be sent- NOT Grapes
11/27/22 12:17 AM57657NoApples8OK
11/27/22 12:17 AM13456YesApples8OK
11/27/22 12:20 AM54765YesBananas9Error- Apples should be sent- NOT Bananas
11/27/22 12:20 AM98798NoApples9Error- Apples should be sent- NOT Grapes
11/27/22 12:24 AM88776YesGrapes10OK
11/27/22 12:24 AM88567NoGrapes10OK
11/27/22 12:27 AM69879YesLemon11Error- Two Lemons were sent
11/27/22 12:27 AM59889YesLemon11Error- Two Lemons were sent
11/27/22 12:28 AM87989NoPeaches12OK
11/27/22 12:28 AM09809YesApples12OK
11/27/22 12:29 AM05465NoLemon13OK
11/27/22 12:29 AM76489YesApples13OK
11/27/22 12:30 AM98768NoApples14Error- Apple should be sent- NOT Lime
11/27/22 12:30 AM65880YesLime14Error- Apple should be sent- NOT Lime
3 REPLIES 3
MatthewO
Alteryx Alumni (Retired)

@bleu the attached workflow accomplishes the results you have shared above. I hope this is helpful for you!

 

image.png

binuacs
21 - Polaris

@bleu One way of doing this with the Multi-Row formula

 

IIF([Sent] = 'Yes' AND [Item] = 'Apples' AND [Row+1:Sent]='No', 'OK',
IIF([Sent] = 'Yes' And [Item] != 'Apples' AND [Row+1:Item] = 'Apples','Error- ' + [Row+1:Item]+' should be sent- '+ 'NOT '+ [Item],
IIF([Sent] = 'No' AND [Item] = 'Apples' AND !isNull([Row-1:Item]),'Error- Apples should be sent- NOT '+[Row-1:Item],
IIF([Sent] = 'No' AND [Item] = 'Apples' AND isNull([Row-1:Item]) AND [Row+1:Item] = 'Apples' AND [Row+1:Sent]='Yes','OK',
IIF([Sent] = 'No' AND [Item] = 'Apples' AND  isNull([Row-1:Item]),'Error- Apples should be sent- NOT '+[Row+1:Item],
IIF([Sent] = 'Yes' AND [Item] != 'Apples' AND !isNull([Row-1:Item]) AND [Row-1:Item] != [Item] ,'Error- Apples should be sent- NOT '+[Item],
IIF(([Sent] = 'Yes' AND  [Sent] = [Row+1:Sent] And [Item] = [Row+1:Item]) 
	OR ([Sent] = 'Yes' AND  [Sent] = [Row-1:Sent] And [Item] = [Row-1:Item] ),'Error - Two ' +[Item]+' Sent','OK')))))))
	

 

 

binuacs_0-1669934375552.png

 

bleu
8 - Asteroid

Thank you MatthewO! That works! 😁

 

binuacs, thank you- it's so concise. I love it! For some reason I couldn't get it to work when I changed the fruit to Grapes. I think I'm doing something wrong in that multi row.

Labels
Top Solution Authors