Public

# Receipe to use for distributing rows in different ranges based on values of Single column

Options
Registered Posts: 4 ✭✭✭

I would like to use a recipe that can distribute rows in different ranges based on values of a single column.

I would like to do following. Y is the column. I would like to distribute the rows in following manner

• 15=<Y<31 = One range
• 31<=Y <= 35 = Second range
• 40<=Y <= 45 = Third Range
• Y>=50 = Fourth range

I want to do that so that i can run the below formula afterwards.

Var X (Remaining quantity)
IF (15=<Y<31) { X = A - B}
ELSE IF
(31<=Y <= 35 ) {
X = C - B}
ELSE IF
(40<=Y <= 45) {
X = D - B}
ELSE IF
(Y>=50) {
X==0
}

## Best Answer

• Alpha Tester, Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Dataiku DSS Adv Designer, Registered Posts: 193 ✭✭✭✭✭✭✭
Answer ✓
Options

In both steps, you can use the Formula processor in the Prepare recipe using nested if statements: if(condition, value if true, value if false)

If you are simply classifying into quartiles, you can also use a Window recipe, provide a sorting column and compute 4 quantiles (see image).

I hope this helps.

## Answers

• Registered Posts: 4 ✭✭✭
Options

Thank you @Manuel
- It works

Help me…