Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Tool Mastery

Explore a diverse compilation of articles that take an in-depth look at Designer tools.
Become a Tool Master

Learn how you can share your expertise with the Community

LEARN MORE

Tool Mastery | Sample

MattD
Alteryx Alumni (Retired)
Created

Sample.pngThis article is part of the Tool Mastery Series, a compilation of Knowledge Base contributions to introduce diverse working examples for Designer Tools. Here we’ll delve into uses of the Sample Tool on our way to mastering the Alteryx Designer:

 

The Sample Tool allows you selectively pass patterns, block excerpts, or samples of your records (or groups of records) in your dataset: the first N, last N, skipping the first N, 1 of every N, random 1 in N chance for each record to pass, and first N%. Using these options can come in the clutch pretty often in data preparation – that’s why you’ll find it in our Favorites Category, and for good reason. While a great tool to sample your data sets, you can also use it for:

 

  • Flexible parsing (attached in the workflow Sample.yxzp)

1.png

Input formats like the above are especially common with transactional data stores.

 

  • Stripping (often Excel) formatting from input tables (attached in the workflow Sample.yxzp)

2.png

 

See here for a more detailed walkthrough on how to input data that doesn't start in the first row.

 

  • Quick appending min/max or chronological first/last in date types (attached in the workflow Sample.yxzp)

Image.png

 

This can also be done with groups of records by using the “Grouping Fields” selection in the Sample Tool’s configuration. The technique itself is also possible, and with multiple fields at a time, using the Summarize Tool.

 

With use cases like the above, the Sample Tool is easily 1 of every N=1,000,000!

 

By now, you should have expert-level proficiency with the Sample Tool! If you can think of a use case we left out, feel free to use the comments section below! Consider yourself a Tool Master already? Let us know at community@alteryx.com if you’d like your creative tool uses to be featured in the Tool Mastery Series.

 

Stay tuned with our latest posts every Tool Tuesday by following Alteryx on Twitter! If you want to master all the Designer tools, consider subscribing for email notifications.
 

Additional Information

Click on the corresponding language link below to access this article in another language -

Portuguese
Spanish
French
German
Japanese

Attachments
Comments
anishbhola
7 - Meteor

Hi @MattD

I think the images in the last workflow are incorrectly represented.

First Image should have been in output browse and the second one in the input browse.

Kindly correct me if I am wrong.

Thanks 

RichoBsJ
11 - Bolide

Hi @, I think @anishbhola is right.

Pictures in the workflow 'Quick appending min/max or chronological first/last in date types' have been placed one in the place of the other and vice versa,

as the column 'Max Scale' was created from the maximum value extracted by the Sample tool.

Regards

 

MattD
Alteryx Alumni (Retired)

Thanks for pointing that out for us, @anishbhola and @RichoBsJ! The images should be fixed with our last revisions.

 

Best regards,

MattD

mikepawlik
5 - Atom

Images referenced above are still out of order.

NeilR
Alteryx Alumni (Retired)

@mikepawlik It looks correct to me. Can you be more specific?

mikepawlik
5 - Atom

I am referencing the images in the Sample.yxzb workflow. They have not been corrected.

NeilR
Alteryx Alumni (Retired)

Ah. Better now, @mikepawlik ?

jdemeaux
8 - Asteroid

it's allright @NeilR 

When you used one of the tools, is it possible to know with what statistical procedure it was extracted? No matter what tool is used.. Thank you. 

Janos_B
5 - Atom

 

Hi Everyone,

 

I've just attempted to use the sample tool for returning the last (1) row from an Excel (xlsx) file by selecting the "Last N rows" option and setting N = 1.

Still it does return all the rows in the file. Can anyone tell why it happens, and more importantly how - if at all - can this tool be used to return indeed just the last single row?

 

Alteryx - Sample tool - 2019-04-10_11-43-53.png

Dear Janos_B,

 

The tool must work extracting a single record N = 1, maybe you need to use Sort Tool before use Sample. This is the easy way to you obtain the sample.

 

Best, 

Valeria

KatieA
Alteryx Alumni (Retired)

@Janos_B 

 

I just tested your scenario and it worked. 

 

Input Data tool with XLSX file and Sample tool with Last N rows = 1.

 

I understand my response is late but please let me know if you are still experiencing this behavior.

 

Thanks,

Katie

salgamez
6 - Meteoroid

Week2-Day3-Sample-Tool-Mastery.PNGThe link highlighted when clicked seems to be broken. I found the sample exercise via search. I believe when clicked it should take the user to this page https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-Sample/ta-p/36758

This is where the link takes you when clicked http://sample%20tool%20mastery/

Oshin_Sharma
5 - Atom

Hi @salgamez,

 

I have a quick inquiry about your post, if you don't mind me asking. I have started alteryx course recently and going through the program day by day. But I seem to have lost the page that your posted. I don't know where do I go for weekly or day-to-day curriculum. Can you please help me? 

Thank you 

mjsnyder
7 - Meteor

When using the sample tool, it randomly selects the data.

SRR
5 - Atom

In @Flexible Parsing (Image 1 workflow), How is the output of sample 1 of every N=3 not having any null rows or row containing rep,sale,date header values in the first work flow? How does the tool sample only valid and relevant numerical data ?

yatish1164
7 - Meteor

Liked the one in a million reference 😄 !! Good article.

Tyrane782001
7 - Meteor

Still learning...

mvtejano
7 - Meteor

Interesting and very helpful. Thank you.

Gayitri420
7 - Meteor

thanks for this explanation

Anitha1289
7 - Meteor

Images referenced above are still out of order.

Shyam_amarapu_2002
7 - Meteor

5-atom

nadiralam
7 - Meteor

I am referencing the images in the Sample.yxzb workflow. They have not been corrected.

eliaskurian
6 - Meteoroid

 @NeilR  It seems the sampling tool stops sampling as soon as it selects a NULL row. Is this by design? For instance, if I select the option 1 in 5 rows, in the above workflow, I would ideally expect an output of 60/5 = 12 rows. However, the function exits as soon as a NULL row is selected as a sample. 

Kindly correct me if my understanding is wrong. 

 

@SRR, the excel file by design contained  NULLs in 3N+1 rows. So, when you sampled, Alteryx merely selected the 3Nth rows resulting in real data. If Alteryx had selected NULL rows as a sample, I believe sampling would have stopped at that point. Probably by design, or maybe the function is coded in the backend to exit once a NULL row is encountered. 

Mohitku123
6 - Meteoroid

STILL LEARNING.

NeilR
Alteryx Alumni (Retired)

@eliaskurian I get 13 rows:

NeilR_0-1672426062819.png

 

eliaskurian
6 - Meteoroid

 @NeilR  Thanks for your time and prompt reply. 

 

I can replicate your results. I guess I made some stupid error yesterday because of which I got a different result. Sincere apologies for making a comment with wrong information. 

 

My earlier comment is fairly misleading and is of no use for the forum users. Can you help me delete the same.

Aditya_88
5 - Atom

Good

Blue1
7 - Meteor

Thank you all for valuable posts - great tool to learn!

FláviaB
Alteryx Community Team
Alteryx Community Team

@Blue1, we are happy to have you as part of our amazing Community! 

Mgaurav2grt
7 - Meteor

its amazing

Pbhargavarao
5 - Atom

A valuable explanation. thank you @MattD