Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

IF statement with dates

Inactive User
Not applicable

Hi community!

I have the following dataset:

date_activation, which is the year-month-date for a subscribers activation

dn, which is dial number, an identifier per subscriber

usage of megabytes, which shows the sum of usage per month per subscriber

month_usage, year-month-date (1st of each month) of usage.

Both date-columns are dates.

 

I want to flag and filter out “month 0” and “month 1”, but I am having troubles with the formula. “Month 0” is when the month and year of date_activation is the same as the month and year  of month_usage. “Month 1” is when month_usage is the month after date_activation.

I am trying with an IF-statement, but I am not sure how to treat the dates:

IF ([date_activation], %m) = ([month_usage], %m) THEN "0"

ELSEIF ([month_usage]=[date_activation],%m+1) THEN "1"

ELSE "other"

ENDIF

 

How do I tell Alteryx that I want to only compare the month and year and also how do I add the next month for “Month 1”?

 

Thank you in advance!

2 REPLIES 2
LordNeilLord
15 - Aurora

Hey @Inactive User 

 

Have a look at this page, it's the best online resource for date handling with Alteryx: https://help.alteryx.com/10.1/Reference/DateTimeFunctions.htm

 

You'll want to have a look at DateTimeDiff functionality to achieve what you need, which would be something like DateTimeDiff(StartDate, EndDate, 'months') = 0 Then etc....

 

Neil

zynex-it
5 - Atom

When I use this, it groups everything that has a <4 week variation. It's not grouping based on calendar month. 

Labels