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

Alteryx Designer Desktop Discussions

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

How do I get the top 10% of a dataset

xspunky
7 - Meteor

Would I use the sample tool to get the top 10% of people? I have been trying to get the top 10% of a category but I am not too sure. 

7 REPLIES 7
ShankerV
17 - Castor

Hi @xspunky 

 

Yes, you can use the below Sample tool with the highlighted setting to get top/first 10% of the dataset.

 

ShankerV_0-1674277965668.png

 

If you believe your problem has been resolved. Please mark helpful answers as a solution so that future users with the same problem can find them more easily!!!!

 

Many thanks

Shanker V

 

xspunky
7 - Meteor

is there another way to get the top 10% of a set? I think my results aren't accurate enough. 

ShankerV
17 - Castor

Hi @xspunky 

 

I am not sure why it was not accurate. I have used it many times and it works fine. 

Could you please share some screenshots or any information to deep dive on the issue.

 

However proposing another way below.

 

ShankerV_0-1674279673933.png

 

Input was:

 

ShankerV_1-1674279702216.png

 

 

Many thanks

Shanker V

 

ShankerV
17 - Castor

Hi @xspunky 

 

To explain in detail, I have used Tile tool with below setting.

 

I have used number of times = 10 because you need 10% from the data.

 

ShankerV_0-1674279778752.png

 

Then I did filter on Tile Num = 1 which will get the result of first 10percent of data.

 

ShankerV_1-1674279854670.png

 

Hope it helps!!!

 

Many thanks

Shanker V

 

xspunky
7 - Meteor

Ss of alteryx.PNG

DataNath
17 - Castor
17 - Castor

Hey @xspunky, the sample approach is absolutely right here. However, as you're selecting the top 10% based on the value within the records, rather than purely just the first 10% of records, you'll first need to Sort your data based on the relevant field (in your case, it'll be the column representing restaurant spend, sorted descending i.e. highest to lowest). Now when you take the top 10%, it'll be in order of spend. Here's a quick example where I've generated 10k rows, assigned them all a random value up to 50,000 and then sorted/isolated the top 1k (10%):

 

DataNath_0-1674336020261.png

xspunky
7 - Meteor

thank you so much, this was the exact thing I was looking for. I did everything correct, except sorting the data before the sample tool of 10%. 

Labels