cancel
Showing results for 
Search instead for 
Did you mean: 

Tool Mastery | Multi-Field Formula

Alteryx
Alteryx

This article is part of the Tool Mastery Series, a compilation of Knowledge Base contributions to introduce diverse working examples for Designer Tools. Here we’ll delve into uses of the Multi-Field Formula Tool on our way to mastering the Alteryx Designer:

 

The Multi-Field Formula Tool offers the same functionality as the Formula Tool, but offers the added benefit of applying a function across multiple fields of data all at once.  Gone are the  days of writing the same function for multiple fields.


Say there are four fields with dollar signs ($) that need to be removed. It could be done with a Formula Tool and a function written for each field:

 

 

Or write it once in the Multi-Field Formula Tool:

 

 

Before:

 

 

After:

 

 

This will save time if any edits are needed and keep workflows a little cleaner.

 

A couple tips for using this tool:

 

 

  1. Make sure the correct field/data types are selected for the function being performed (e.g. string functions being applied to string fields).
  2. By default the ‘Copy Output Fields and Add’ check box is selected. This keeps the original fields and adds the output data as new fields at the end of the dataset with the specified prefix or suffix.
  3. The output data type can be changed using the ‘Change Output Type’ check box. When using this option keep the resulting data type of the function in mind and make sure it matches the selected output data type.
  4. The variables under 'Current Field' will use the fields selected in section 1 in the above image.
  5. Using _CurrentField_ in the expression will use the selected field names individually in the function.

You can also reference the field name or data type in your formula by using _CurrentFieldName_ or _CurrentFieldType_, respectively.

 

Use Cases:

Use this tool for the same use cases as the Formula Tool with the added flexibility of applying the same function across multiple fields at once! Update fields, perform calculations, cleanse data…

 

In the attached example 3 Multi-Field Formula tools are used to update 8 fields! (The example workflow is compatible with Alteryx 10.5 and later.)

 

By now, you should have expert-level proficiency with the Multi-Field Formula Tool! If you can think of a use case we left out, feel free to use the comments section below! Consider yourself a Tool Master already? Let us know at community@alteryx.com if you’d like your creative tool uses to be featured in the Tool Mastery Series.

 

Stay tuned with our latest posts every Tool Tuesday by following Alteryx on Twitter! If you want to master all the Designer tools, consider subscribing for email notifications.

Comments
andrew_cook
Meteoroid

Hello Peter,

 

Thanks for this. Your post is very helpful. I believe I have a problem that could be solved with this tool, however I'm not sure how to apply it. I have a data set containing an employee hierarchy. Basically, I follow the reporting structure from top (CEO) to bottom (employee's direct supervisor). Each row is an employee who could have 1-11 levels of leaders between them and the CEO. All other level fields are NULL. I want to identify the first NULL value in each row (which could be in any column) and replace the null with the employee's ID. Will this tool help or is there a better way?

 

Thanks much, Andy

Alteryx
Alteryx

Hi @andrew_cook,

The Multi-Field Formula tool probably won't be the best tool for what you are trying to accomplish.  I have come up with an example that I believe demonstrates what you are trying to do, however, I can not attach a file to responses on this post so keep an eye out for an email from support@alteryx.com with the example.

 

Peter

andrew_cook
Meteoroid

 Thank you Peter. This is exactly what I needed!

 

Regards, Andy

Alteryx
Alteryx

You are welcome @andrew_cook  Thanks your your involvement with the Alteryx Community! If  you don't find an answer to future questions feel free to post it in one of the discussion boards or send us an email at support@alteryx.com

 

Have a good one,

Peter

M_G
Meteor

A new user of Alteryx, well versant with MS Access. Just trying to do some simple aggregate queries in Alteryx but can't seem to find what would be equivalent to 'Where' clause in Access.

I have a fairly large table and I'm trying to get count of Rpt_No based on certain Report Date cut off. Can't seem to find a way to specify date in the Summarize tool while doing Count on Rpt_No. I'm sure it would be fairly easy if you know how to do it.

@M_G Check out the filter tool. You can specify something like [Report Date] >'2016-12-01' in order to get just those records with report dates after 12/1/2016. Then you can use a summarize tool to get counts.

M_G
Meteor

Thanks @, yes that seems to work. Smiley Happy

M_G
Meteor

Now that I'm trying to do similar record count on a much bigger table, with Filter and Summarize tools, I run into 'Conversion Error' due to some records with invalid data in the Date filed. And Alteryx just hangs up and does not give me record count. I know there are indeed some invalid dates in the Report Date field and want to ignore those records, as I don't have any control over the data or the database.