Alteryx Designer Desktop Discussions

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

How to Select or Filter dates that are closest to end of current month

jaypee1217
7 - Meteor

I've created a workflow that calculates a payroll accrual file for different Batch IDs. I'm trying to take it to the next level where if there are multiple dates the workflow selects/filters the closest date to the end of the current month. This would represent the population that the remainder of the workflow would then calculate an accrual. 

 

I'm stuck at this point. I don't know how to filter/select the smallest value in [Diff to End of Current Month] for each Batch ID row. 

 

Batch IDPay Period End DateCurrent MonthDiff to End of Current Month
A4/14/20234/30/202316
A4/28/20234/30/20232
B4/5/20234/30/202325
B4/15/20234/30/202315
C4/20/20234/30/202310
C4/12/20234/30/202318

 

 

 

Desired Output

 

Batch IDPay Period End DateCurrent Month
A4/28/20234/30/2023
B4/15/20234/30/2023
C4/20/20234/30/2023
8 REPLIES 8
ScottLewis
8 - Asteroid

There may be a more elegant solution but this works. Summarize on min of difference, join on min difference and batch ID. 

 

ScottLewis_1-1686236928479.png

 

 

EdwardCochrane
7 - Meteor

Can you use a sort tool and then a sample tool?

jaypee1217
7 - Meteor

i went down the sort and sample path, but i couldnt get around the variable of different batch id's and variable smallest value. 

jaypee1217
7 - Meteor

Thanks Scott. Let me give this a whirl. 

binuacs
20 - Arcturus

@jaypee1217 Another option convert your date fields into Alteryx Date type then find the maximum date using the summarize tool and join the original input file

binuacs_0-1686237399040.png

 

prakashkaur189
6 - Meteoroid

I have tried a different approach. Download the attached flow and see if this helps.

 

prakashkaur189_0-1686238505486.png

 

jaypee1217
7 - Meteor

Thank you everyone for the prompt responses. Scott's worked in my data set and is the simplest to insert into my overall model. 

jaypee1217
7 - Meteor

This is awesome. Just ran the updated workflow and it matched my original output. Now the user doesn't have to visually choose (around 30 out of 70-80 files) input files that are the last pay date in a month. Select ALL and now the output will be just the last pay period data. woot woot. 

 

Labels