Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Firstsortedvalue Max

Hi,

I have data which shows the price (field name Price) bid in different markets.

I would like to create an expression which returns the below for each of the highest Prices:

MarketMaker, Price, Quantity

I thought it would be something like FirstSortedValue(MarketMaker,-aggr(Max(C1Price),MarketMaker)), however this doesn't always return a value.  Would this expression not work if more than one value are the maximum Price?

Regards,
Daniel

5 Replies
Anil_Babu_Samineni

How about simply this?

FirstSortedValue(MarketMaker, -Price)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
danielnevitt
Creator
Creator
Author

Thanks again for the quick reply.

Would that expression work if there are more than one value with the maximum price?  Also does it recognise negative values?

Thanks

Anil_Babu_Samineni

I can say yes for both cases.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
danielnevitt
Creator
Creator
Author

Sorry another quick question.

Is there a way to calculate the firstsortedvalue when the Executed field = Y.

Something like FirstSortedValue({Executed={'Y'},Buyer,-Price)?

Thanks,
Daniel

Anil_Babu_Samineni

Yes, Perhaps this way

FirstSortedValue(Buyer,-Sum({<Executed={'Y'}>} Price))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful