ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Find the closest date out of 2 other columns

wonka1234
10 - Fireball

Hi,

 

Say I have [column1] with a date value of 2023-07-11 and

 

[column2] with a value of 2023-07-31 

 

and [column 3] with a value of 2023-08-30

 

how can I find the column closed to column 1 in a formula? the answer would be column 2 in this instance.

1 REPLY 1
FrederikE
13 - Pulsar

Hey @wonka1234,

 

IF
DateTimeDiff([Field1],[Field2],'days')
>
DateTimeDiff([Field1],[Field3],'days')
THEN "Field2"
ELSE "Field3"
ENDIF

Screenshot 2023-08-14 170253.png

Labels
Top Solution Authors