Hi guys, need your help on filtering the rows based on conditions. Here is my sample data.
Country | Category | Buy/Sold | Model |
US | Online | Buy | XACV |
US | On Premise | Buy | XACV |
US | On Premise | Buy | HSID |
US | Online | Sold | JVIC |
US | On Premise | Buy | JVIC |
US | Hybrid | Sold | HVUC |
US | Online | Sold | UTVS |
US | Hybrid | Buy | KVIC |
US | Online | Sold | IOCL |
US | Hybrid | Sold | IOCL |
US | On Premise | Buy | IOCL |
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.
Country | Category | Buy/Sold | Model |
US | Online | Sold | JVIC |
US | On Premise | Buy | JVIC |
US | Online | Sold | IOCL |
US | Hybrid | Sold | IOCL |
US | On Premise | Buy | IOCL |
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!!
Solved! Go to Solution.
Hi @bb
Here's a simple solution:
- 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,
You can optimize it by using 4 tools : - Summarize + Forumula + Join + Filter.
Hi @bb
Here's another approach.
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
All this approach works great guys. Thank you so much!!