Alteryx Designer Desktop Discussions

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

Top N per week

Nouha
6 - Meteoroid

Hello everyone, 

 

I am working on a dataset with arount 10 million rows that looks like this

 

week      Product     Sales

 

week 1   A                 592

week 1   B                    38

week 3   A                   15

week 2   F                 4589

...            ...              ....

...          ...                 ....

...         ...                 ....

 

my goal is to have an output that is a table of the highest 3 seling products for every week like this

 

week        product       sales    rank

Week 1     A                589        1

Week 1     C                65          2

Week 1     D                40          3

Week 2     F               1589        1

Week 2     A                 689         2

Week 2     E                200          3

....             ...;             ...           ....

 

does anyone know how to achieve this ??

 

thank you so much 

 

6 REPLIES 6
ponraj
13 - Pulsar

Possible to share the sample data in an excel sheet ?

jdunkerley79
ACE Emeritus
ACE Emeritus

Based on what you sent something like:

- Sort by Week Ascending then by Sales Descending

- Use a multirow formula tool grouped by week to create a rank column with expression of `[Row-1:Rank]+1`

 

If you can post so sample data happy to build example

Nouha
6 - Meteoroid

Hello, 

 

thank you,

 

i have shared a sample of my data set

 

ponraj
13 - Pulsar

Here is the sample workflow for your case.  Hope this is helpful. 

WorkflowWorkflowResultsResults

jdunkerley79
ACE Emeritus
ACE Emeritus

Attached my solution

2018-11-20_11-12-58.png

Nouha
6 - Meteoroid

That's so helpful thank you very much

Labels