Alteryx Designer Desktop Discussions

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

how to use an output to filter out on a formula

VeronicaElse
8 - Asteroid

Hello,

 

I need to use a formula to filter out several items and then for those that are false to come out in an output

 

thanks

17 REPLIES 17
Luke_C
17 - Castor

Hi @VeronicaElse 

 

Some sample data might be helpful here to get you to the right option. Two thoughts:

 

  1. Using a formula tool, you would not lose any data. You could add a column to evaluate your condition and return True/False for each record, then process as needed.
  2. Using the filter tool the false records will all output from the 'F' anchor.

Luke_C_0-1618258809815.png

 

apathetichell
18 - Pollux

You can create a new Boolean variable in the formula and then assign it "False" based upon the conditions being met. Then you use a filter as described by @Luke_C and connect and output data tool  to your False anchor...

VeronicaElse
8 - Asteroid

I am not sure how to provide sample data since it is confidential.

 

I need to have filter/formula for MDO Name= GBG, Program= 01 or 02, Plan Code= 1G or 2D, MEthod received= V or W, Received by= 1

 

and so forth then these  columns that do not have these specific things listed to come as false statement? And can this come out as an output as well, is this possible?

 


ANY HELP IS GREATLY APPRECIATED.

 

🙂

 

 

VeronicaElse
8 - Asteroid

So, use the Boolean Variable for all the columns I listed and assign it to False? So this would all be in one column formula?

 

Sorry I am new to this field 😕

apathetichell
18 - Pollux

It's up to you if you want to assign it true or false as long as you standardize it and make the value uniform  - but if you use a ton of and statements in your formula tool you can check that all the variables all match/don't match and then set a uniform boolean variable for the columns you want outputed.

 

You can then filter for the variable which you want and then output from the anchor.

 

Let's say that I want to extract records where a, b and c don't have certain values:

 

I'd use if A!=x and B!=Y and C!=Z then "True" else "false" endif

 

then in my filter i'd just put the new field name and it will test for it.

 

In this case I'd want the True anchor.

VeronicaElse
8 - Asteroid

Thank you--- so I added all the columns with what they should = but for the filter which column name do I use or do I have to separate each column to have its own true/false statement?

 

I don't know what to put for my filter to filter out all the columns with FALSE

 

thanks

Luke_C
17 - Castor

Hi @VeronicaElse 

 

It really depends on the logic, is there one ultimate column that you need to filter the dataset on or multiple? The filter tool offers a 'Basic' and 'Custom' filter options. For basic, filtering out false is super easy and would just depend on if the datatype of the field is a string or bool. If it's bool, you would see the following (note, in both examples you'd need to use your own fields instead of 'field1')

 

Luke_C_0-1618322604996.png

 

If it is string, you can do something like this:

Luke_C_1-1618322646316.png

 

For a custom filter (i.e. you want to filter out where column A AND/OR column B is false) you could try something like the below - again depending on the data types:

Luke_C_2-1618322818186.png

 

As always, any sample data or screenshots you provide will help get you the best approach. 

 

Luke_C
17 - Castor

Also would recommend this interactive lesson on filtering. It's only 7 minutes and well worth the time. 

 

https://community.alteryx.com/t5/Interactive-Lessons/Filtering-Data/ta-p/76301

 

apathetichell
18 - Pollux

If you have a final column where the entries you want are all labeled "false" you can filter that column - and  if its boolean just put it in the customer filter...

 

ie [boolean field]

 

Your false records will now be in the false anchor.

 

NOTE - say for design sake you want to take all the records from the true anchor - even though their boolean value is false... you can use:

not([boolean field]) or ![boolean field] - both of which would produce not(false) - or True.

Labels