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

Solved!
nikhil1
Level 2
Receipe to use for distributing rows in different ranges based on values of Single column

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
}

0 Kudos
1 Solution
Manuel
Dataiker Alumni

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.

 

View solution in original post

2 Replies
Manuel
Dataiker Alumni

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.

 

nikhil1
Level 2
Author

Thank you @Manuel - It works

0 Kudos