Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Remco
Contributor III
Contributor III

Stupid question but can´t figure it out...

I have plain data set with PORTFOLIOPERIOD,  setup like 202212 where we have the year and the month, another field that is ID and a third being a concatenate of several columns from each line.

I need to find 2 strings for the concatenation, one where PORTFOLIOPERIOD is the highest in the set and with the highest ID within that period. The other is where PORTFOLIOPERIOD is the second highest in the set and also here again, the concatenated string with the highest ID in that period.

Max(ID,1) and Max(ID,2) work fine but I want the concatenated output and not just the ID. A 'max' over the string does not work. A MaxString over the concatenation also works but there is no such thing as MaxString(Description,2).

Any suggestion?

 

Thanks!

Labels (2)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

use FirstSortedValue()

 

Highest

= FirstSortedValue( ID & ' - ' & PERIOD , -ID, 1 )

 

Second Highest

= FirstSortedValue( ID & ' - ' & PERIOD , -ID, 2 )

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

1 Reply
vinieme12
Champion III
Champion III

use FirstSortedValue()

 

Highest

= FirstSortedValue( ID & ' - ' & PERIOD , -ID, 1 )

 

Second Highest

= FirstSortedValue( ID & ' - ' & PERIOD , -ID, 2 )

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.