问题
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.
来源:https://stackoverflow.com/questions/38634275/fetching-the-max-value-from-rows-in-pentaho