Alteryx Designer Desktop Discussions

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

How to create smart classification for list of numeric values using formula tool.

Ravy12
7 - Meteor

Hello Experts,

 

I have a list of prices(numeric values) and I am looking to create two fields called Price classification and Price sub classification using formula tool based on the values for Prices.

 

1. Price Classification: This is straightforward and I am able to build this using the formula tool.

 

Price ClassificationExplanation
>1000All prices greater than 1000 USD
500-1000All prices between 500 to 1000 USD
400-500All prices between 400 to 500 USD
300-400All prices between 300 to 400 USD
200-300All prices between 200 to 300 USD
100-200All prices between 100 to 200 USD
000-100All prices between 0 to 100 USD
<0All negative prices

 

2. Price Sub Classification : This is where I am struggling. This is a drill down to Price classification based on the price value. Please see the explanation below:

 

Each Price classification has 10 price sub classification.

For eg, 0-100 has following Price Sub classification depending on the price value:

 

Price classificationPrice Sub Class definitionExplanation
0-1000-100-0All values between 0 to 10
0-1000-100-1All values between 10 to 20
0-1000-100-2All values between 20 to 30
0-1000-100-3All values between 30 to 40
0-1000-100-4All values between 40 to 50
0-1000-100-5All values between 50 to 60
0-1000-100-6All values between 60 to 70
0-1000-100-7All values between 70 to 80
0-1000-100-8All values between 80 to 90
0-1000-100-9All values between 90 to 100

 

 

Similar definition for other subclass
Price classificationPrice Sub Class definitionExplanationExplanation 2
400-500400-500 -4All values between 440 to 450All values in 440's
200-300200-300-9All values between 290 to 300All values in 290's
100-200100-200-6All values between 160 to 170All values in 160's

 

Exceptions in case of two price classification viz. 500-1000 and >1000 (where the jump is more than 100 and hence further detail added in the sub classification).

 

Here's the sub classification explanation:

 

Price sub classification for 500-1000.

Second number in Price sub classification shows the jump of value from 500 and the last number shows value of last two digits price.

Price USDPrice ClassificationPrice Sub classificationExplanation
567500-1000500-1000 - 0 - 60-6 because the value range is 560's
587500-1000500-1000 - 0 - 80-8 because the value range is 580's
612500-1000500-1000 - 1 - 11-1 because (5+1 jump) for 600 and last two digits in 10's
642500-1000500-1000 - 1 - 41-4 because (5+1 jump) for 600 and last two digits in 40's
702500-1000500-1000 - 2 - 02-0 because (5+2 jump) for 700 and last two digits in 0's
714500-1000500-1000 - 2 - 12-1 because (5+2 jump) for 700 and last two digits in 10's
803500-1000500-1000 - 3- 03-0 because (5+3 jump) for 800 and last two digits in 0's
942500-1000500-1000 - 4- 44-4 because (5+4 jump) for 900 and last two digits in 40's

 

 

Price Sub classification For >1000

Price USDPrice ClassificationPrice Sub classificationExplanation
1012>1000>1000-0-10-1 because (1000+0 jump) from 1000 and last two digit in 10's hence 1
1078>1000>1000-0-70-7 because (1000+0 jump) from 1000 and last two digit in 70's hence 7
1102>1000>1000-1-01-0 because (1000+1 jump) from 1000 and last two digit in 0's hence 0
1145>1000>1000-1-41-4 because (1000+1 jump) from 1000 and last two digit in 40's hence 4
1189>1000>1000-1-81-8 because (1000+1 jump) from 1000 and last two digit in 80's hence 8
22473>1000>1000 - 22 -4 - 77 in tens place (70's), 4 in 100's place (400's) and 22 in thousands place (22000's)
31758>1000>1000 - 31 - 7 - 55 in tens place (50's), 7 in 700's place (700's) and 31 in thousands place (31000's)
31879>1000>1000 - 31 - 8 - 77 in tens place (70's), 8 in 800's place (700's) and 31 in thousands place (31000's)
11078>1000>1000-11-0 -77 in tens place (70's), 0 in 100's place (100's) and 11 in thousands place (11000's)

 

 

Request you support for building the Price Sub classification field.

 

Attached is the workflow build so far and the excel sheet with data.

 

Regards, Ravi

1 REPLY 1
Aguisande
15 - Aurora
15 - Aurora

Hi @Ravy12 

Below you'll find a rough WF to make what you need.

The basic steps are, separating (FILTER) the stream to apply different conditions.

In this case, you'll find several filters that separates: 0-500, 500-1000, >1000 and negative values.

Then, I created a value (the min value of each bucket) to compare the Price against it and use the results to get the desired deltas.

 

I had no time to finish the >1000 category nor tiding up the workflow (I'll do this later), but wanted to show an approach asap.

 

Hope this helps

Labels