Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Run an IF statement for each ID

I need to create a new column that returns an 'Event Time' based on very specific logic. There are millions of IDs in my dataset and each ID can have multiple PO Items, so I created the 'ID plus PO' column as a unique identifier. 

I need to iterate on EACH OF THESE UNIQUE IDENTIFIERS. For example, for each unique ID, if 'Custom' = 1, I want to return the 'Event Time' where 'Custom' = 4. Please let me know if I need to provide additional context.

 

 

 

 

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Anonymous Perhaps:

    Column = 
      VAR __ID = [ID plus PO]
      VAR __Custom = [Custom]
      VAR __Result = 
        IF(
          __Custom = 1,
          MAXX( FILTER('Table', [ID plus PO] = __ID && [Custom] = 4), [Event Time]),
          BLANK()
        )
    RETURN
      __Result