Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Remove rows based on date information

agnesr
5 - Atom

Hi All,

 

I have an input file where in the first column I have dates. In this specific column there are always two different dates (as file relates to WoW comparison). 

I need to add a step when I delete all of the rows related to prior date as presented below. 

Please note number of the rows are not constant and I always need to delete prior date data so relevant date will change for every week/run.

 

Hope you can help me out here. 🙂

 

Input:

 

DateCode
2021.03.12xyz
2021.03.12abc
2021.03.12wrsfswf
2021.03.12sfdsa
2021.03.12sdfv
2021.03.12sdfv
2021.03.12sdfv
2021.03.19sac
2021.03.19sdc
2021.03.19sadc
2021.03.19favvgf
2021.03.19fgbbngh

 

Necessary outcome:

DateCode
2021.03.19sac
2021.03.19sdc
2021.03.19sadc
2021.03.19favvgf
2021.03.19fgbbngh

 

Many thanks,

Agi

4 REPLIES 4
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @agnesr,

 

You will need to parse the date field into the Alteryx date format, summaris to find the max date of the dataset, append this back and filter for records where the date = max date in the dataset:

 

Jonathan-Sherman_0-1617204827123.png

 

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

TonyA
Alteryx Alumni (Retired)

Another slightly simpler approach is to convert the date and find the max date. Then join the max date back to the output of the date conversion using the converted date as the join key. By the way, in your example you didn't need to convert the date since the format of date strings you used would sort correctly. But it generally is best practice to convert date strings to make sure you do get the correct sort order.

2021-03-31_8-44-40.png

Jonathan-Sherman
15 - Aurora
15 - Aurora

Nice one @TonyA! I always seem to forget about the join condition approach!

agnesr
5 - Atom

Thank you both for the prompt solutions, I tried second one and worked smoothly.

To be honest I skipped the DateTime tool as previously I set data type to date using select tool. 

 

Labels
Top Solution Authors