Alteryx Designer Desktop Discussions

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

Multi-Field Formula Expression to Update Multiple Columns Based on a Given Criteria

jstarke
5 - Atom

Hi All,

 

I am trying to update multiple columns without having to repeat the same formula over and over again for each column.   The help files on the multi-field formula do not show an example of how to do this.  I've put together a simplified example as follows:

 

IF MIN(ABS([Delta btwn George and Jane]),ABS([Delta btwn George and Jill])) = ABS([Delta btwn George and Jane]) THEN
      IF ABS(DateTimeDiff(DateTimeTrim([Min Date Jane],"firstofmonth"),DateTimeTrim([Max Date George],"firstofmonth"),"months")) <= 12 THEN
              [Relationship] = "George is dating Jane"
              [Dating Started] = [Min Date Jane]
     ELSE
             [Relationship] = "George is friends with Jane"
             [Dating Started] = Null()
      ENDIF
ELSE
      [Relationship] = "George is friends with both Jane and Jill"

      [Dating Started] = Null()
ENDIF

 

How can I update both the [Relationship] column and the [Dating Started] column at the same time without having to repeat the same formula over and over again?  The real world problem I am working on has 12 columns to be updated based on the same IF condition. Having a bunch of formula tools for each column, each with the same IF condition will be a pain to maintain and/or reuse in other workflows.

 

If the above approach is not possible in Alteryx, please confirm that first if you propose a different way to do it, like cross-tabbing or something.  From what I can tell, the multi-field formula tool is only really a multi-field tool if you want to update multiple columns of the same data type to the same exact value. 

 

Thank you all!

 

Thank you!

3 REPLIES 3
DataNath
17 - Castor

Hey @jstarke - @patrick_digan actually built a macro that caters to this, taking features from both Multi-Row and Multi-Field Formula tools: https://community.alteryx.com/t5/Community-Gallery/Multi-Row-Field-Column-Macro-example/ta-p/879896

jstarke
5 - Atom

Thanks @DataNath !  I will take a look at that.

gyang3
Alteryx Alumni (Retired)

Hey @jstarke, if DataNath's post helped to solve your problem, please mark that as a solution so others can benefit. If not, let us know what's missing so we can continue the conversation!

Labels