8 Replies Latest reply: Apr 24, 2017 9:14 AM by Shivani Singhal

# Output of the expression

What is the exact meaning of this expression and what will be the output?

=FirstSortedValue({<Paid_Date = {"<=\$(=Date(Upto,'D/M/YYYY')) "}>} Outstanding,-Paid_Date)

• ###### Re: Output of the expression

It gives the 1st value of the Outstanding with the max Paid_Date  which is less that the selected Upto Date.

• ###### Re: Output of the expression

Could you please explain how its giving me the maximum paid date.

Also.. what does (-Paid_Date) indicate?

• ###### Re: Output of the expression

Imagine you have the following table:

FieldA, FieldB

A, 3

B, 4

C, 1

D, 2

If you run a FirstSortedValue(FieldA, FieldB) you'll get the first sorted value from FieldA based on the sorting of FieldB. Value 1 is the first value for FieldB so the function will in this example return C. (FirstSortedValue())

So if we keep "-" before the field B, it will be sorted in reverse order, returning B which is value for Max value in FieldB.

Same is the case with PaidDate(field B) and outstanding(Field A).

And again set analysis is applied to filter the values based on FieldB.

• ###### Re: Output of the expression

So..it will fetch the latest Paid_Date and will give the outstanding on the basis of this latest Paid_Date...Am I right Shiva?

• ###### Re: Output of the expression

... as long as there's exactly one distinct value matching...

• ###### Re: Output of the expression

Thanks Robin. I got my answer.

• ###### Re: Output of the expression

Latest paid Date which is less than selected "Upto" value

• ###### Re: Output of the expression

Thank you so much Shiva for solving this query.