ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

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

Perform Multiple T/F Filters on Same Column at the Same Time

5 - Atom

I'm creating a workflow that takes a dataset with transactions from all 50 states, pulls the states we need, and performs different processes to create different files for each state. Each state's file is a completely different format and requires different data, so they each will have their own separate processing line and output.


So, say I have data from all 50 states, and I need to pull the data for AL, CA, KS, and VA, and run different transformations on each state.


I know I can run a series of Filters, where I just keep filtering for a single state and splitting it off, then filtering to the next state I need, etc. But I need about 15-20 states, and I'm worried about the efficiency of having 20 consecutive filters in place.


Is there a way to do a filter-type step so that instead of only filtering into two categories ("AL" and "not-AL") and repeating the process over and over again, I can filter it into several ("AL," "CA," "KS," "VA," and "Everything else") at once?

12 - Quasar

Hi @matthewblandford - consider using an IN clause. You can still split off the states that you need to treat separately but this will give you your "other" bucket in one tool. Don't fret having multiple filters, luckily Alteryx doesn't charge us by the tool 🙂 





See the attached example and mark this as a solution if it does what you're looking to accomplish

5 - Atom

Hi Blake,


I didn't know about the IN clause; that will certainly be helpful for other steps. I should have clarified that I'll actually be disregarding the "other" bucket, so it's not as important to me to get that bucket in one tool. I'm really only interested in if it's possible to perform the action without multiple filters - mostly out of my own desire to slim the workflow when possible, and attempt to make it as efficient as possible.


If there isn't a tool that can do multiple filters in one step, I can still mark your answer as the solution, since that would be the right answer to my question. I just wanted to check before potentially making my workflow more tedious than it needs to be.

17 - Castor
17 - Castor

Hi @matthewblandford 


When you say a "tool that can do multiple filters in one step", do mean something like this?



If so, then the answer is "No. There isn't a tool that can perform multiple filters in one step."  But you can make one.  The Filter by state shown above is a standard macro that just encapsulates all the filters in a separate workflow.  Internally it looks like this 



The input records are filtered in sequence with the matching ones sent to Macro Output tools.  


In my opinion, @Blake's answer is still better than this one.  All this really does is hide the filters.  For a production workflow,  I'd recommend something more along these lines



Here the individual processes are grouped and highlighted.  Since the filter is an integral part of the process for each state, it's included in the corresponding process container and documents how the records are selected for that process.




5 - Atom

Thank you to both @Blake and @danilang 


I've accepted Blake's answer as the solution, though I do appreciate your explanation and suggestions, Dan!