Calculate max value of a column

How to calculate max value of a column without using aggregrator transformation?

Questions by riteshpathak10

Showing Answers 1 - 12 of 12 Answers

You need to feed your ports through an Aggregator Tranformation.  eg.

Input  = salary.  Not output
Output = maximum_salary --> max(salary) - Output

Connect the maximum_salary fields to the output to use it
Define other keys as "Group by" as needed.

You cannot use max(salary) function in expression - it only works on a single row

  Was this answer useful?  Yes

dihydrox

  • Dec 5th, 2008
 

If you just need to get the max value by the end of session (to increment a value or put at the bottom of a flat file ) you can do the following. 

Let's say you need to find the max value for a port called INCOME.
You feed rows through an expression. You create a new port that is either going to be local variable or output (depending what you want to do with it). Call it  CURR_MAX and place it after the INCOME port. It will have the expression

IIF(CURR_VALUE>INCOME,CURR_VALUE,INCOME). That should do it.

Otherwise, you either need to use a sorter which does caching anyway, an Aggregator
or do a lookup on the source you are reading from where the lookup override SQL calculates the max(for relational) or it you are reading from a relational DB like Oracle, use an analytic function

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions