Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I display the record with the minimum date

I know that this must involve the FirstSortedValue function and possibly the Aggr function as well...

First, I don't have control over the Load as this is QlikView Advanced Reporting in Quickbooks.. 

In a Straight Table, I'm trying to display only the record for each SO # that has the earliest Txn Date. For the Amount field, I have the Expression built this way:    sum({$<[Transactions.Txn Type]={'Invoice'}>} Transactions.Amount)

So for SO# 6922-1, I'd want to see only one record since the same date displays twice. For SO# 6922-2, I'd want to see one of the records that has the 3/23/2017 date.

Txn Type

Item TypePO #SO #Txn DateAmount
InvoiceServiceItem7FEB2017DJACOBSON6922-103/23/2017$926.40
InvoiceServiceItem7FEB2017DJACOBSON6922-103/23/2017$1,890.40
InvoiceServiceItem7FEB2017DJACOBSON6922-204/30/2017$360.52
InvoiceServiceItem7FEB2017DJACOBSON6922-203/23/2017$926.40
InvoiceServiceItem7FEB2017DJACOBSON6922-203/23/2017$1,890.40
InvoiceServiceItemP2546695304/21/2017$1,134.54
InvoiceServiceItemP2546695305/25/2017$1,134.54
InvoiceServiceItem2045184697204/19/2017$926.40
InvoiceServiceItem2045296697804/28/2017$926.40
InvoiceServiceItem2045296697804/26/2017$1,890.40
InvoiceServiceItem2045472698005/05/2017$1,890.40
InvoiceServiceItem2045610699105/18/2017$463.20
InvoiceServiceItem2045610699105/18/2017$945.20
InvoiceServiceItem2045755699505/24/2017$1,890.40
InvoiceServiceItem2045860700505/31/2017$463.20
InvoiceServiceItem2045860700505/31/2017$945.20
InvoiceServiceItem2045898701806/15/2017$926.40
InvoiceServiceItem2046419703707/06/2017$463.20
InvoiceServiceItem2046419703707/06/2017$945.20
InvoiceServiceItem2046573705207/19/2017$926.40
21 Replies
Not applicable
Author

That looks right, but I'm getting this:

     

Txn TypeItem TypePO #SO #Txn DateAmount
InvoiceServiceItem7FEB2017DJACOBSON6922-103/23/2017-
InvoiceServiceItem7FEB2017DJACOBSON6922-203/23/2017-
InvoiceServiceItem7FEB2017DJACOBSON6922-204/30/2017-
InvoiceServiceItemP2546695304/21/2017-
InvoiceServiceItemP2546695305/25/2017-
InvoiceServiceItem2045184697204/19/2017-
InvoiceServiceItem2045296697804/26/2017-
InvoiceServiceItem2045296697804/28/2017-
InvoiceServiceItem2045472698005/05/2017-
InvoiceServiceItem2045610699105/18/2017-
InvoiceServiceItem2045755699505/24/2017-
InvoiceServiceItem2045860700505/31/2017-
InvoiceServiceItem2045898701806/15/2017-
InvoiceServiceItem2046419703707/06/2017-
InvoiceServiceItem2046573705207/19/2017-
vishsaggi
Champion III
Champion III

What are your dimensions and expressions in your straight table?

Use dimensions :  TxnType, ItemType, PO#, SO#

Use expressions: the two FirstsortedValue() functions.

Is that how you did?       

Not applicable
Author

Ok - I set it up like you said. Now I get one row for each SO# (which is good), but the values for the Txn Date and the Amount display as '-'.

      

Txn TypeItem TypePO #SO #AmountTxn Date
InvoiceServiceItem7FEB2017DJACOBSON6922-1--
InvoiceServiceItem7FEB2017DJACOBSON6922-2--
InvoiceServiceItemP25466953--
InvoiceServiceItem20451846972--
InvoiceServiceItem20452966978--
InvoiceServiceItem20454726980--
InvoiceServiceItem20456106991--
InvoiceServiceItem20457556995--
InvoiceServiceItem20458607005--
InvoiceServiceItem20458987018--
InvoiceServiceItem20464197037--
InvoiceServiceItem20465737052--

Thank you for your help on this.

vishsaggi
Champion III
Champion III

Can you show the expressions you are using?

Not applicable
Author

= FirstSortedValue( {$<[Transactions.Txn Type]={'Invoice'}>} [Transactions.Txn Date], Aggr([Transactions.Txn Date], [Transactions.Txn Type], [Transactions.Item Type], [Transactions.PO Number],[Transactions.Sales Order Number], [Transactions.Txn Date]))

=FirstSortedValue( {$<[Transactions.Txn Type]={'Invoice'}>} [Transactions.Amount], Aggr(sum( Transactions.Amount), [Transactions.Txn Type], [Transactions.Item Type], [Transactions.PO Number],[Transactions.Sales Order Number], [Transactions.Txn Type]))

vishsaggi
Champion III
Champion III

Try these?

= FirstSortedValue(  [Transactions.Txn Date],  Aggr([Transactions.Txn Date], [Transactions.Txn Type], [Transactions.Item Type], [Transactions.PO Number],[Transactions.Sales Order Number], [Transactions.Txn Date]))

=FirstSortedValue(  [Transactions.Amount], Aggr(sum( Transactions.Amount), [Transactions.Txn Type], [Transactions.Item Type], [Transactions.PO Number],[Transactions.Sales Order Number], [Transactions.Txn Type]))

Not applicable
Author

okay - the Txn Date and Amount display, but the SO# is displaying '-'.

Also, I do need the Set Analysis in there

vishsaggi
Champion III
Champion III

Can you share this sample you are working on?

Not applicable
Author

I assume you mean the .qvw...

vishsaggi
Champion III
Champion III

Its protected and asking for password. Can you remove the authentication or give me the password and reattach. ?