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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Showing the latest record

Hi

I want to display the customer record with the latest date on a chart/table.Please assist.

e.g

CustomerIDAddress1Address2CityCode Address_Change_Date
12312 kloof rdNewcastleNew Zealand2654101/01/2012
1235 Frey Street BradysToronto00012306/05/2012
12345 Lombardy roadLombardyKimberly5623001/02/2013
4620 Leeds StreetFayaBrazil56987405/08/2011
4612 Gorg rdMeridCanada6965601/05/2012
Labels (1)
5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

If you want just one value (the max) use Max in your expression or when you load data.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Use the firstsortedvalue function. See attached example. You'll have to make sure no customer id's have two records for the same date though or firstsortedvalue will return a null. So if you have a customer that changes addresses twice (or more) on the same day you're out of luck. There's no way to determine which is the record the right one then.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks,

unfortunately some of my records have same dates.

alexandros17
Partner - Champion III
Partner - Champion III

when you load data, let's suppose that the name of the field is myData, add

....

left join

Select

     Key,

     max(myData) as Maxim

from myTable

where Key is the key of the table from wich you actually exctract the field data

In this way your original table ill have a new colunmn containing always max value.

This metod let you compute even other dates for examnple by year

Not applicable
Author

Same dates for one customer and the dates do not have time.That is why it showing nothing with the firstsortedvalue function.