Fetching the max value from ROWS in pentaho

一笑奈何 提交于 2019-12-12 03:23:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!