Alteryx Designer Desktop Discussions

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

IF Statement with Dates

Kristie_Pires
8 - Asteroid

Hello community,

 

I am looking to have a formula that says: "If the [Date] is equal to or greater than the 11th of the prior month, then "New Item". Today is 2022-09-28

 

DateComment 
2022-09-02New Item
2022-08-11New Item
2022-08-09"Leave blank"

 

The formula needs to be dynamic. Thank you :) 

5 REPLIES 5
binuacs
20 - Arcturus

@Kristie_Pires One way of doing this

 

binuacs_0-1664380076387.png

 

Emmanuel_G
13 - Pulsar

@Kristie_Pires 

 

Find in attachement the way of doing that.

 

Emmanuel_G_0-1664380197755.png

 

Kristie_Pires
8 - Asteroid

Thank you @binuacs - it worked for my situation! 

 

I understood how the formula works except for the "7". I might have to use something similar in the future and I want to grasp it ;) 

binuacs
20 - Arcturus

@Kristie_Pires Let me explain the formula in detail

 

Left(toDate(DateTimeAdd(DateTimeToday(),-1,'Month')),7)+'-11', 'New Item','')

 

DateTimeAdd(DateTimeToday(),-1,'Month') - will return the previous month

ToDate() - function will convert the above DateTime value to just Date value (The time part will be ingnored)

Left() - function used to take from left to 7 character length. For example Left('2022-09-02',7) returns first 7 characters i.e 2022-09

 

 

 

Kristie_Pires
8 - Asteroid

Thank you both for helping me out! @binuacs Thanks for explaining so that I can replicate the formula in the future 😊

Labels