Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Values from latest date based on Uniqueid

Hi All,

I need to fetch the amount based on the Max of the date.

There are multiple values for each uniqueid.

Example

Date              amount                Uniqueid

   

11/27/2015 :. 23119079TEFA_U4d11f4
11/26/2015 :. 22335359TEFA_U4d11f4
11/30/2015 :. 8707045TEFA_U4d11f4

In the above scenario i should Fetch the last amount 8707045.

Only the values from latest date based on Uniqueid. Attached the Qvw.

Please help me with this.

Regards,

Keerthi KS

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

Data:

LOAD

     uniqueid, 

     grandtotal as GrandTotal,

     Date(approvedo1,'M/D/YYYY h:mm:ss[.fff] TT') as ApprovedDate

    

FROM

(qvd);

INNER JOIN(Data)

LOAD

uniqueid,

Date(Max(Date), 'M/D/YYYY h:mm:ss[.fff] TT')  AS ApprovedDate

RESIDENT Data

Group By uniqueid;

View solution in original post

5 Replies
Anonymous
Not applicable
Author

like this?

=sum({<Date=, Date={'=$(=Date(max(Date),'MM/DD/YYYY'))'}>} Amount)

sunny_talwar

Try this:

Dimension: uniqueid

Expressions:

1) =Date(Max(ApprovedDate), 'MM/DD/YYYY')

2) =FirstSortedValue(Aggr(Sum(GrandTotal), uniqueid, ApprovedDate), -ApprovedDate)

Not applicable
Author

I want to do it while loading. B

sunny_talwar

Try this:

Table:

LOAD

     uniqueid, 

     grandtotal as GrandTotal,

     Date(approvedo1,'M/D/YYYY h:mm:ss[.fff] TT') as ApprovedDate,

     Date(Floor(approvedo1)) as Date

FROM

(qvd);

Right Join (Table)

LOAD uniqueid,

  Max(Date) as Date

Resident Table

Group By uniqueid;

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

Data:

LOAD

     uniqueid, 

     grandtotal as GrandTotal,

     Date(approvedo1,'M/D/YYYY h:mm:ss[.fff] TT') as ApprovedDate

    

FROM

(qvd);

INNER JOIN(Data)

LOAD

uniqueid,

Date(Max(Date), 'M/D/YYYY h:mm:ss[.fff] TT')  AS ApprovedDate

RESIDENT Data

Group By uniqueid;