Multi-Field Formulas in Alteryx

by Finn Charlton

If you've ever wanted to update or add multiple calculated fields in Alteryx, this one is for you.

Imagine you have this dataset:

It lists the distribution costs for multiple products. Distribution costs here are made up of packing, transporting and receiving costs. The contribution of these to the distribution costs are listed as percentages. Say you want to calculate the actual cost of picking, transport and receiving. Yes, you could write three separate formulas to make three new columns, but there is a more efficient way: the multi-field formula tool.

As you can see above, you can only choose one "output column" at a time in the normal formula tool.

In the Multi-Field Formula tool, you can select multiple output columns (just by ticking them). If you tick the "Copy Output Fields and Add" button, you will create a new output column and keep the original. Leaving it unticked will overwrite the original column.

We can now write our Multi-Field Formula expression. Treat this as a normal formula but with one change: it will run through this formula for every field you have selected (ticked) above. Use the "Current Field" variable as a stand-in for the fields you have selected.

When we run this tool for our above dataset (and rename some fields), we can see that all of the "percent" fields have been multiplied by the "Distribution Cost" field. With just 3 fields this may not save much time over using normal formulas, but imagine doing this manually with 50 or 200 fields! This is where the multi-field formula tool really shines.