Alteryx Designer Desktop Discussions

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

Formula to select rows based on paritions

champ24
7 - Meteor

Hello,

 

I am trying to select data if a month exists in a given date range. The formula I am using in the filter tile is:

([YEAR]=datetimeyear([START_DATE]) or [YEAR]=DateTimeYear([END_DATE])) and ([MONTH] >=DateTimeMonth([START_DATE]) and [MONTH]<=DateTimeMonth(END_DATE]))

 

It works if a person has only one single date range. But if a person has multiple date ranges then its not excluding data correctly. Below is the snapshot of input and expected output. Months 5,6,7 doesnt exist in the start_date and end_date ranges and those rows shd be the output.

 

alteryx1.JPG

 

Is this possible?

13 REPLIES 13
atcodedog05
22 - Nova
22 - Nova

Hi @champ24 

 

It is definitely possible can you please provide sample input data. Can prep up the workflow.

champ24
7 - Meteor

Sure. Sample Data file is attached.

Please note Month is based of below format (Fiscal year/month):

15-DEC-2019' and '14-JAN-2020' then month is  1
 '15-JAN-2020' and '14-FEB-2020' then month is  2
 '15-FEB-2020' and '14-MAR-2020' then month is  3
 '15-MAR-2020' and '14-APR-2020' then month is  4
 '15-APR-2020' and '14-MAY-2020' then month is  5
15-MAY-2020' and '14-JUN-2020' then month is  6
 '15-JUN-2020' and '14-JUL-2020' then month is  7
 '15-JUL-2020' and '14-AUG-2020' then month is  8
 '15-AUG-2020' and '14-SEP-2020' then month is  9
 '15-SEP-2020' and '14-OCT-2020' then month is  10
15-OCT-2020' and '14-NOV-2020' then month is  11
 '15-NOV-2020' and '14-DEC-2020' then month is  12

 

 

Below is expected output. 

OUTPUT
IDYearMonthName
a11120205Randle Wood
a11120206Randle Wood
a11120207Randle Wood
a22220201Barista John
a22220202Barista John
a22220203Barista John
a22220204Barista John
a22220205Barista John
a22220206Barista John
a33320201Scott Lenn
a33320205Scott Lenn
a33320206Scott Lenn
a33320207Scott Lenn
a33320208Scott Lenn
a33320209Scott Lenn
a333202010Scott Lenn

 

Thanks

atcodedog05
22 - Nova
22 - Nova

Hi @champ24 

 

Here is a workflow for the task.

 

Input: given file

Output:

atcodedog05_0-1603217216620.png

As your expected but in your output for 2nd ID a222 there is 6 rows instead there should be 10 rows based on input can you check.

 

Workflow:

atcodedog05_1-1603217242205.png

 

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

champ24
7 - Meteor

Thank you. I just realized there are a couple of situations that I shd have included earlier. I have updated the sample data file.

 

Expected output shd be:

a44420204Shawn B
a44420205Shawn B
a44420206Shawn B
a44420207Shawn B
a44420208Shawn B
a44420209Shawn B
a444202010Shawn B
a55520201Zen A
a55520202Zen A
a55520203Zen A
a55520204Zen A
a55520205Zen A
a55520206Zen A
champ24
7 - Meteor

for the above attached dataset the workflow is working partially. Is it possible to achieve desired output in alteryx?

atcodedog05
22 - Nova
22 - Nova

Hi @champ24 

 

I will check and get back to you.

Qiu
20 - Arcturus
20 - Arcturus

@champ24 
While @atcodedog05  takes the break, I would like share my thoughts on this.
And maybe I misinterpret what you want, I am getting something different with your out, unless the sample data is not updated?

I manually checked, and think maybe I am correct.

1021-champ24.PNG

atcodedog05
22 - Nova
22 - Nova

Hi @champ24 

 

Here is the modified workflow the task.

 

Output:

atcodedog05_0-1603259168819.png

Workflow:

atcodedog05_1-1603259196075.png

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

grazitti_sapna
17 - Castor

Hi @champ24 , give this workflow a try.

 

grazitti_sapna_0-1603266608088.png

 

 

Thanks.

Sapna Gupta
Labels