Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Return Last Sting In Field

Hi All,

I have this set of data

Claimant TypeClaim NumberVer NoPayment ReservesRecovery ReservesPaymentsRI RecoveriesNon RI Recoveries
ADRS1002021925.000.000.000.000.00
ADRS1002022925.000.000.000.000.00
ADRS1002023925.000.000.000.000.00
PIRS10020214585.000.000.000.000.00
PIRS10020224585.000.000.000.000.00
PIRS10020234585.000.000.000.000.00
TPRS10020211000.000.000.000.000.00
TPRS10020221000.000.000.000.000.00
TPRS10020231000.000.000.000.000.00


I wish to return the maximum Ver No and then the corresponding data with that row ( See Below ). I have used the MAX function in an expression to select the maximum Ver no. What expression can i use to return the string which corresponds with the rest of the data on the Max Ver No field?

Claimant TypeClaim NumberVer NoPayment ReservesRecovery ReservesPaymentsRI RecoveriesNon RI Recoveries
TPRS10020231000.000.000.000.000.00
PIRS10020234585.000.000.000.000.00
ADRS1002023925.000.000.000.000.00


Thanks in Advance

Regards
James

21 Replies
Miguel_Angel_Baeyens

Hello,

If you only want to show the product with the maximum sales, try Product as dimension and this as expression

Only({< Sales = {$(=Max(Sales))} >} Sales)


Hope that helps

Not applicable
Author

Hi Miguel

your solution only returns the reults for the AD & PI rows. i need for every row.

See attached file

Not applicable
Author

Hi,

see the attached example.

Good luck!

Rainer

Not applicable
Author

I love the solution!!!

but why doesnt it work when i do it as an expression???

I appreciate your help

Not applicable
Author

I love the solution!!!

but why doesnt it work when i do it as an expression? Where is the result for PI ??

I appreciate your help



Not applicable
Author

Hi,

it depends on the number of dimensions. See QV Help for more information about AGGR.

Getting the right lines during data reload is the easiest way and response time for end users are low.

Rainer

Miguel_Angel_Baeyens

Hello,

FirstSortedValue() returns one value, so does Max(), and it may require as much aggregations as fields you need to calculate. As you want to get the sum (aggregation) of values in Incurred when there may one or more records with the Max() value, so the following should work in the expression

Sum(If(Aggr(NODISTINCT Max([Claim Transaction Sequence Number]), [Claimant Type]) = [Claim Transaction Sequence Number], Incurred))


Hope this helps.

Not applicable
Author

Thank you Miguel

This seems to work. But only when there is one claim number. as soon as this expression is allocaed to a dataset with more than one claim number it stops working....

This is my fault as i didnt specify in my request or on the example. .

Regards

James

Miguel_Angel_Baeyens

Hello James,

Actually this expression is another option to what Rainer accurately suggests, meaning that depends on your datamodel and your chart the number of aggregations you have to do. Adding the "Claim Number" to the aggregation, the formula works:

Sum(If(Aggr(NODISTINCT Max([Claim Transaction Sequence Number]), [Claimant Type], [Claim Number]) = [Claim Transaction Sequence Number], Incurred))


Hope that helps.

Not applicable
Author

Hi

I am in a similar position to before. the difference this time is that i want to return the last text string instead of the last numerical value.

how could this be changed to return the last text string??

Sum(If(Aggr(NODISTINCT Max([Claim Transaction Sequence Number]), [Claimant Type], [Claim Number]) = [Claim Transaction Sequence Number], Incurred))

Many thanks James