community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Need help with row condition

Meteor

Hi guys, need your help on filtering the rows based on conditions. Here is my sample data.

CountryCategoryBuy/SoldModel
USOnlineBuyXACV
USOn PremiseBuyXACV
USOn PremiseBuyHSID
USOnlineSoldJVIC
USOn PremiseBuyJVIC
USHybridSoldHVUC
USOnlineSoldUTVS
USHybridBuyKVIC
USOnlineSoldIOCL
USHybridSoldIOCL
USOn PremiseBuyIOCL

 

I want to show only the rows that have same Model and are Sold then Bought again. So in this case, I want to show only the rows below from above data.

 

CountryCategoryBuy/SoldModel
USOnlineSoldJVIC
USOn PremiseBuyJVIC
USOnlineSoldIOCL
USHybridSoldIOCL
USOn PremiseBuyIOCL

 

I can only filter on duplicate value on model but I'm not sure how to filter data based on rows. I have thousands of rows of data and need to build a model that can do this. Any help would be great. Thanks!!

Alteryx Certified Partner
Alteryx Certified Partner

Hi @bb 

 

Here's a simple solution:

 

Solution1213290.PNG

- Record ID to keep track of rows

- Sort Fields on Country, Model and Buy/Sold condition

- Create a multi-row condition stating if Row-1 is "Sold" and Row:0 is "buy" that means there's Sold/Buy. Flag = 1.

- Filter records with that Flag

- Unique Tool to identify models.

- Join these models to the dataset by Country and Model (Get only Right part of dataset)

- Sort by Record ID to put everything back to order

 

WF appended.

 

Cheers,

 

Alteryx
Alteryx

Hello, 

 

Here you go, I used few tools to achieve the results. If this answers your question, please check the post as "answered" :) 

 

Thanks !! 

 

OutputDemo.JPG

Alteryx
Alteryx

You can optimize it by using 4 tools : - Summarize + Forumula + Join + Filter. 

output3.JPG

Pulsar
Pulsar

Hi @bb 

Here's another approach. 

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

First, create a unique ID for each Model (many ways to do this, I like the Multi-Row approach)

Then concatenate the Buy/Sell column for each different Model

 

The records you want will contain the text "SoldBuy" in the summarized field.

 

Join back to the original data to pull the appropriate rows.


Please let me know if this works for you.

Cheers!
Esther

Meteor

All this approach works great guys. Thank you so much!!

Labels