We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Mark "Period" based on Date

StutiG612
6 - Meteoroid

I have two dated in my data.

Lets say,

 

30/09/2023 and 30/11/2023

 

I want to add a column for Period and mark the most recent one as "Current and the older one as "Previous".

 

Dates will keep changing and the difference in months or years may vary too so I can not use the if formula.

 

IS there any way i can do this?

5 REPLIES 5
dwstada
11 - Bolide

@StutiG612 here is a way to do this, if I understood correctly

 

stutig612 current period.PNG

Hammad_Rashid
11 - Bolide

You can use the following formula to add a column for Period and mark the most recent date as “Current” and the older one as “Previous”:

IF [Date1] > [Date2] THEN "Current" ELSE "Previous" ENDIF

 

Replace [Date1] and [Date2] with the names of the columns that contain your dates. This formula will compare the two dates and return “Current” if the first date is more recent than the second date, and “Previous” otherwise.

 

If you have more than two dates and want to mark the most recent date as “Current” and the rest as “Previous”, you can use the following formula:

IF [Date] = MAX([Date]) THEN "Current" ELSE "Previous" ENDIF

 

Replace [Date] with the name of the column that contains your dates. This formula will compare each date to the maximum date in the column and return “Current” if it matches, and “Previous” otherwise.

 

I hope this helps! 

StutiG612
6 - Meteoroid

Both my dates are in the same column. Any alternative for that?

StutiG612
6 - Meteoroid

I will only have two dates in this column. So i just need to have the latest one as current and other one as previous. i can not really mention via record id here as the data is very comprehensive. It has multiple lines of current and previous date.

CoG
14 - Magnetar

Here is one way that I believe will do what you need:

Screenshot.png

Labels
Top Solution Authors