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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
mpcastro
Contributor
Contributor

Filter records by surveillance data.

Hey guys.

I have this structure:

 

Company Sector Effective date Cost center
1 8 01/05/2024 2569
1 8 01/10/2023 2545
1 7 01/04/2024 6352
1 6 01/01/2024 3665
1 6 01/11/2023 3645
1 6 01/10/2023 3609

 

I have the effective date as a filter.

I need to set up a dashboard with records with a date less than or equal to the filter's effective date, returning only 1 record per key (company,sector).

I've already searched on several forums, but I can't find a solution.
Thanks.

Labels (1)
1 Reply
Sayed_Mannan
Creator II
Creator II

Hi, You can achieve this by using the FirstSortedValue function. This function returns the first sorted value of an expression, sorted by another expression.

try this

Load
Company,
Sector,
FirstSortedValue(Effective_date, -Effective_date) as Effective_date,
FirstSortedValue(Cost_center, -Effective_date) as Cost_center
Resident YourTable
Where Effective_date <= YourFilterDate
Group By Company, Sector;

In this script, replace YourTable with the name of your table and YourFilterDate with the date you have as a filter. 

Please replace the field names with your actual field names if they are different. This script should give you a new table with filtered records as per your requirement.

I hope this helps!