Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Help with Record Numbering

Anweinbe
7 - Meteor

 

UPDATED: I figured it out! the TILE WIDGET!!! Very easy. Sorry everyone for the clutter. Hope this helps others!!!

 

Good morning all.

 

I have a sorted file that shows me how many products are sold by week. I want to create a new field that takes the averages of the last 6 weeks of data only. I don't want to hardcode these field names as that could cause issues when I update my data. I always want the last 6 weeks of what is in the dataset. 

 

Here is what I am thinking in my head that should work.. I thought that if I have 20 records for the product, I could sort the dates descending and then tag the first record as 1, second as 2 etc., and restart the count at the next product. Set a filter on records <7 and then crosstab the results. Then make a new field that averages 1-6. 

 

My issue: How do I apply a tag to show the 1, 2, 3 down the list restarting at a product change? Probably a simply tool I am overlooking!

 

Thanks so much!

 

4 REPLIES 4
SPetrie
13 - Pulsar

Multi-Row tool. Group it by the product and add 1 to the item above it

SPetrie_0-1682948717286.png

Grouping can mess with your sorting, so you can also check if the product above is different than the current product and increment that way as well.

SPetrie_1-1682948831532.png

 

Anweinbe
7 - Meteor

Thank you for the reply. Do you suggest over the Tile Widget that I used? Perhaps they both work?

DataNath
17 - Castor
17 - Castor

Hey @Anweinbe, rather than needing to create an ID and then filter based upon that, you can just sample the top N records. Once you've sorted by your date, just use a Sample tool and take the first 6 records, ensuring that you group by your Product:

 

DataNath_0-1682949183764.png

 

Example attached.

Anweinbe
7 - Meteor

That does work too, however if I want to report on different averages that could get messy. This does help me in a different area of my workflow though.

 

I found the Tile tool which seems to be working as long as I sort correctly first. Have you used that before? Trying to determine what drawbacks exist on it if any. 

Labels
Top Solution Authors