We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

What sort of macro is appropriate? Is a macro appropriate?

AKB
8 - Asteroid

Hi all,

 

I have a set of records containing numbers between 0 and 1. A value somewhere between 0 and 1 shall be found that divides these records into groups, whose sizes I then calculate. I'd also like to output and know the dividing value that produced these group sizes.

 

I imagine that this dividing value might be found by some sort of macro, presumably a batch or iterative macro. Which sort is appropriate?

 

As an example we might have

 

0.1

0.8

0.27

0.28

 

as our input records. 

 

With a threshold of 0.275, we would divide the records into two groups, each of size 2.  The output might then look like [original input | greater than threshold | threshold]:

 

0.1    0   0.275

0.8    1   0.275 

0.27  0   0.275

0.28  1   0.275

 

How can I scan over all dividing threshold values between 0 and 1, say in steps of 0.001? I am unclear on how to best do this? The dividing value is need as an output also.

 

Thx much - 

2 REPLIES 2
PhilipMannering
16 - Nebula
16 - Nebula

I'd say either is appropriate. If you plan on changing your threshold values regularly then a batch would be more suitable (you would pass a list of thresholds as your batch group), otherwise I would go with an iterative (one where you start with say, 0.001 and each iteration you add 0.001, and add a filter - threshold < 1 - where the True anchor connects to your iterative macro output and False anchor connects to a standard macro output).

 

You can also do this with a Generate Rows, example attached,

PhilipMannering_0-1682689376267.png

 

AKB
8 - Asteroid

Ah, I had not used the Generate Rows tool before but now I see its utility. Thank you for an elegant and simple solution and your quick reply. 

Labels
Top Solution Authors