Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

FirstSortedValue issue

Hey all,

I'm having difficulty getting values using FirstSortedValue.  I'm trying to retrieve the latest "amount" per record but I am getting null values and I'm not sure why. Here's what my script looks like:

=FirstSortedValue(amount, -date)

I would greatly appreciate the help.

Thanks,

Napac

*EDIT*

I feel I should clarify what I'm looking for.  I'm trying to extract the latest total amount per account.

Account                             Amount                    Date

1                                        25                           4/30/13

2                                       432                          4/30/13

2                                       324                          4/30/13

2                                       381                          5/1/13

1                                       89                            5/1/13

1                                       9821                        5/1/13

2                                       423                          5/2/13

For instance, I would want to sum the latest amounts for accounts 1 and 2 without bringing in any amounts before the latest date

16 Replies
Anonymous
Not applicable
Author

This works, thank you so much!

jolivares
Specialist
Specialist

Hi Swuehl, I have a similar problem and try to adapt you solution but with not result... may you check this.

swuehl
MVP
MVP

The sort weight (second argument to FirstSortedValue() function) needs to be numeric.

So you should create your year-month field AM using a QV date function, not using string operations.

See attached.

pablolabbe
Luminary Alumni
Luminary Alumni

Hi Rob,

  Your tip about duplicates on sort column helped me and my coleague to solve a customer issue.

Thank you,

Pablo Labbe

sujeetsingh
Master III
Master III

Samuel can you please explain that how this works in ?

Not applicable
Author

Hi everyone,

I make this works fine when i'm on the application on my computer, but as soon as i distribute it on the server, it shows random data, like if the firstsortedvalue() doesn't work on ajax.

@

=FirstSortedValue(DISTINCT aggr(count({<[APP STATUS]={'Deployed'},[APP ENVIRONNEMENT]={'Production'},[PERSONROLE]={'Supportedby'}>} DISTINCT [APP ID]),Date),-Date)

Do you have any idea ? I'm getting crazy here

bsbernabe
Creator
Creator

Hi Swuehl, I have a also similar problem for this, but the different i have is IDType, so im trying to use your sample its working but i need to add the ITDType.

=If (IDType= 2,FirstSortedValue( aggr(sum(RATING),HEADERID,CREATEDDATE), -aggr(CREATEDDATE,HEADERID,CREATEDDATE) ),PARTTYPE)

Note: Can you correct me fro this expression.

Thanks Bing