Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

flag cancelled transcations

Jocelynupup
7 - Meteor

Hi, 

 

I have a big dataset showing the transaction details. Based on it, I created the table 1 as an example and result as my expected outcome.

My problem is: 

I want to flag cancelled transactions. I was supposed to use join tool to match buy and cancel. However, some cashiers may make a mistake. They cancel the wrong transaction and do the buy again. Which means their identifiers are exactly same, same date, same TransID. So, I am trying to use their time to find those cancelled transactions. Maybe multi-row formula tool? But I don't know how to write the expression. The logic is after the sorting (time, TransID), if there is a cancel transaction, [TransID]Row -1=[TransID]Row,  [Amount]Row -1=[Amount]Row, then flag [cancelled]Row -1 and [cancelled]Row as "x". I wonder whether we can do it in Alteryx.

 

table 1:

TransIDDatetime transactionAmount
211/1/20239:00:00 AMbuy25
411/1/202310:30:00 AMbuy100
111/1/202310:00:00 AMbuy10
111/1/202310:01:00 AMcancel-10
411/1/202310:31:00 AMcancel-100
511/1/202311:00:00 AMinquiry0
111/1/202310:02:00 AMbuy10
311/1/202311:00:00 AMbuy30

 

result:

TransIDDatetime transactionAmountcancelled
111/1/202310:00:00 AMbuy10x
111/1/202310:01:00 AMcancel-10x
111/1/202310:02:00 AMbuy10 
211/1/20239:00:00 AMbuy25 
311/1/202311:00:00 AMbuy30 
411/1/202310:30:00 AMbuy100x
411/1/202310:31:00 AMcancel-100x
511/1/202311:00:00 AMinquiry0 

 

Thanks,

Jocelyn

4 REPLIES 4
gautiergodard
13 - Pulsar

Hey @Jocelynupup 

Would this work for you?

TimN
13 - Pulsar

Similar solution

putu_w_erata
8 - Asteroid

A different solution using Summarize

Jocelynupup
7 - Meteor

Thank you! It works! That's my first time to use multi-row tool. It's super helpful for me to understand how a correct expression looks like.

Labels
Top Solution Authors