Alteryx Designer Desktop Discussions

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

Sampling Based on a Data Field

jscott24
5 - Atom

I have a set of data that lists all of the dividend transactions for hundreds of different stocks (each with a corresponding unique CUSIP#), but many of these stocks pay multiple dividends throughout the year, so this data has anywhere from 10 to 2000 entries per stock.  If I build a formula and append a "# to Sample" field to that data set, is there anyway I can sample "X" number of dividend records for a given stock based on that value in the "# to Sample" field?  Within the standard sample tool, I don't see a sample based on formula.  If it let me put N equal to a variable or field (i.e. "# to Sample") then it would be problem solved I guess.  

 

Any thoughts?

 

That # to Sample would be calculated using a summarize function and then a formula to calculate how many per CUSIP, and then I guess I would run the sample off of the raw data.

 

Hopefully this makes sense.  TIA for your help

14 REPLIES 14
mbarone
16 - Nebula
16 - Nebula

When it says the macro has an error in tool #2, you have to look inside the macro and find tool #2, which is the filter tool.  The filter tool is looking at LocationLang field, so probably has to do with that.  Or, it has to do with the action tool not needing the quotes in the "replace" selection.


Glad you like the macro!  If you wouldn't mind, it'd be great if you marked my response as a solution, if you believe it was a suitable solution.


Thanks!

Ramirenter
6 - Meteoroid

@mbarone 

How does one mark a post as an answer? Would "STAR"'ing it would be enough?

mbarone
16 - Nebula
16 - Nebula

To mark accepted, just click on the three ellipses (three dots) to the upper right of the post.  There you'll see an option "accept as solution".


Thanks!

Ramirenter
6 - Meteoroid

@mbarone 
It seems that as I'm not the creator of the post I do not have that option available.

mbarone
16 - Nebula
16 - Nebula

Oh, didn't realize!  No problem, just glad I was able to help!

Labels