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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to select the last record of the same property code by expression

Hi all,

I am new to QlikView. Below is a Straight table: Property_SEQ, Pro_Code, StateDate and EndDate are dimensions; Tenancy Status is an expression.  The purpose is to select the latest Status in a particular period which I use two variables to define (vFrom and vTo).

The expression of Tenancy Status is:

IF(NRAS_EndDate1>=vFrom AND NRAS_StartDate1<=vTo,NRAS_TenancyStatus1)

(say vFrom = 1 /09/2015, vTo=30/09/2015)

my result retrieved several duplicate property with different Tenancy period, but I just want the last one. How could I amend my expression to do that?

data.PNG

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Perhaps (based on EndDate):

=FirstSortedValue(IF(NRAS_EndDate1>=vFrom AND NRAS_StartDate1<=vTo,NRAS_TenancyStatus1),

-EndDate)

Change the second parameter to StartDate if that is what you mean by "latest"

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

Hi Jonathan,

Thanks for your reply.

I tried but it didn't work. The result using FirstSortedValue() is the same.