Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Pull previous 100 records of select data

Lucyxbite
6 - Meteoroid

Hi, 

 

I have some data ( A record of sales) and Im wanting for every individual item pull the last 100 orders 

 

For example purposes  below if I wanted to pull the last 2 records for each it would then give me the example below.

Original Data                    

TitlePurchased
Banana03/06/2021 23:59
Apple 03/06/2021 23:59
Banana03/06/2021 23:59
Orange03/06/2021 23:58
Banana03/06/2021 23:57
Apple 03/06/2021 23:56
Orange03/06/2021 23:55
Banana03/06/2021 23:54
Banana03/06/2021 23:54
Banana03/06/2021 23:54
Orange03/06/2021 23:52

New data 

TitlePurchased
Banana03/06/2021 23:59
Banana03/06/2021 23:59
Orange03/06/2021 23:58
Orange03/06/2021 23:55
Apple 03/06/2021 23:59
Apple 03/06/2021 23:56

 

Is there a quick solution to this?

hope you can help

2 REPLIES 2
mceleavey
17 - Castor
17 - Castor

Hi @Lucyxbite ,

 

Great to see you active on the community 🙂

 

You can do this using sorting and sampling:

 

mceleavey_0-1622806649621.png

 

Your sample tool can select the first X amount grouped by a given field:

 

mceleavey_1-1622806682121.png

 

mceleavey_2-1622806705414.png

 

I've attached the workflow for you.

 

C.

 

 

 



Bulien

danilang
19 - Altair
19 - Altair

Hi @Lucyxbite 

 

You can do this quite easily, by sorting by Item and Date descending and then using a Sample tool to get the First 2 rows for each fruit

 

 

danilang_0-1622806825048.png

 

Dan

Labels