-->

Fetching the max value from ROWS in pentaho

2019-09-17 19:53发布

问题:

I have a table structure

ID  Col_1  col_2  col_3  col_4
1    34     23     45     32
2    20     19     67     18
3    40     10     76     86

I here want the max value from col_1,col_,col_3,col_4 so my output looks like

 ID   Col_1   col_2  col_3  col_4  max
    1    34     23     45     32   45
    2    20     19     67     18   67 
    3    40     10     76     86   86

any help would be much appreciated.

回答1:

Use a Modified Java Script Value step with the following code:

var max = Math.max(col_1,col_2,col_3,col_4);


回答2:

You can use Memory Group By or Group By steps in Pentaho. Use the aggregation method as "Maximum" based on your grouping id.