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: 
dhananjay_capge
Partner - Contributor III
Partner - Contributor III

How to get updated Records

Hi there,

i have sample data like

ID,
Name,
Dat

AB3.JPG

Currently data shows 3 records with 2 same ID.

AB1.JPG

But i want to show updated data as per date update.
Output should be below screen-shot.

AB2.JPG

Thanks,

DJ

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

I assume you want the name for the maximum date as well as the date itself for the ID. Use a straight table:

     Dimension: id

     Expr1: FirstSortedValue(Name, -Dat)

     Expr2: Max(Dat)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

7 Replies
tresesco
MVP
MVP

You mean, if duplicate Ids are there, it should take the one with latest date? If so, you can do it in the front-end easily like:

Straight table:

Dim1:Id

Dim2: Name

Exp: Max(Dat)

In the script like:

Load

          Id,

          Name,

          Max(Dat) as Dat

From <> group by Id, Name;

Not applicable

Hi,

As see Name is different and ID is only same

A:

Load

          Id,

          Name,

          Dat

From Table1 ;

B:

Load

          Id,

          Max(Dat) as Dat

From <> group by Id;

Now Join Table A and B based on Column ID and Dat and fetch all columns from table A.

dhananjay_capge
Partner - Contributor III
Partner - Contributor III
Author

Hi Tresesco,

Yes, Your understanding is right.

But when i excute this logic it will show all data.kindly check.

AB4.JPG

AB 5.JPG

Still it shows the all records.

Thanks,

DJ

jonathandienst
Partner - Champion III
Partner - Champion III

I assume you want the name for the maximum date as well as the date itself for the ID. Use a straight table:

     Dimension: id

     Expr1: FirstSortedValue(Name, -Dat)

     Expr2: Max(Dat)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

To do this in the load script:

     LOAD id,

          FirstSortedValue(Name, -Dat) As Name,

          Max(Dat) As Dat

     FROM ...

     GROUP BY id;



Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
tresesco
MVP
MVP

I should have noticed the Name thing earlier. In that case, follow Jonathan's second suggestion below.

prajapatiamar38
Creator II
Creator II

Hi.....

Please find the attachment below.

As said by Jonathan dienst it is correct.

Thanks