Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Preparing Bins of Values

rushabh_shah
8 - Asteroid

Hi,

 

I have a numeric field which contains the revenue earned. I want to bucket this like 0-50,50-100,101-150 and so on.. I tried using Tile node but it gives out put as tile numbers.

I want the Range i.e. 0-50,50-100 to identify the buckets. Is there any possible way to do this?

 

Regards,

Rushabh

 

 

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

Is there a limit to your maximum value? It looks like you want to divide you input by 50 and determine the range that it belongs to. 

Say your value is 201. Divide it by 50 and you get 4.x. The range is 4x50 to 5x50 or 200 to 250. 

 

There is a floor() function and a ceil() function that you can use to calculate 4 and 5. 

 

I would then subtract 1 from the upper limit and make it 200 to 249. 

 

ToString(Floor([value]/50)*50) +  " to " +
ToString((Ceil([value]/50)*50)-1)

My iPhone code is untested, but should get you there. 

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Federica_FF
11 - Bolide

HI,

 

you could create a small table with 2 columns:

 

Label | Tile Number

0-50 | 1

51-100 | 2

and so on...

 

and use a find and replace tool to find the Tile Number field and replace the values with the labels

 

or and if statement (probably without using the Tile Tool at all):

if [Revenue]<=50 then "0-50"
elseif [Revenue] <= 100 then "51-100"
elseif [Revenue] <=150 then "101-150"
else "151+"
endif

Max06270
7 - Meteor

@MarqueeCrew wrote:

Is there a limit to your maximum value? It looks like you want to divide you input by 50 and determine the range that it belongs to. 

Say your value is 201. Divide it by 50 and you get 4.x. The range is 4x50 to 5x50 or 200 to 250. 

 

There is a floor() function and a ceil() function that you can use to calculate 4 and 5. 

 

I would then subtract 1 from the upper limit and make it 200 to 249. 

 

ToString(Floor([value]/50)*50) +  " to " +
ToString((Ceil([value]/50)*50)-1)

My iPhone code is untested, but should get you there. 

 

Cheers,

Mark


 

Hey guys,

 

I was trying the achieve the same results and just want to say that this formula does not return expected results when value is a multiple of range. It gives the following:

 

valuevalue/50floor(value/50)*50ceil(value/50)*50-1resultsexpected
000-10 to -10 to 49
12.50.250490 to 490 to 49
100210099100 to 99100 to 149

 

I don't know it this is the most elegant solution but since the struggle is with the upper side of the bucket and they all have the same size I am simply adding 50. Formula look like this then:

 

ToString(Floor([value]/50)*50) +  " to " + ToString(Floor([value]/50)*50+50-1)

and new results:

 

valuevalue/50floor(value/50)*50floor(value/50)*50+50-1resultsexpected
000490 to 490 to 49
12.50.250490 to 490 to 49
1002100149100 to 149100 to 149

 

Hope it is helpful.

 

Cheers,

Max

derekbelyea
12 - Quasar

 

HI

 

Here is an alternate solution making use of GENERATE ROWS to create standard interval buckets and the JOIN tool to sort the data into these buckets, following Mark's suggestion to use the FLOOR() function. 

 

Derek

Labels