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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
cedfoning
Creator
Creator

select last sigle for each user

Hello,

i have an issue, need help :

i have a table as below

MAT Affectation affectation date start affectation date end
62YTE GE/PDG/IND/SM/DCS/FABCS/DEBFOR/APC 2022-09-05 2999-12-31
62YTE GE/PDG/IND/SM/DCS/FABCS/DEBFOR/FORPLA 2022-09-01 2022-09-04
0976H GE/PDG/IND/BS/2AP/AC/AC6 2022-09-05 2999-12-31
0976H GE/PDG/IND/BS/2AP/AC/AC7 2022-09-01 2022-09-04
HIY67 GE/PDG/IND/SM/DEA/PME/USI1 2022-09-05 2999-12-31
HIY67 GE/PDG/IND/SM/DEA/PME/USI2 2022-09-01 2022-09-04
87ZGS GE/PDG/IND/SM/DEA/PME/USI1 2022-09-05 2999-12-31
87ZGS GE/PDG/IND/SM/DEA/PME/USI3 2022-09-01 2022-09-04
HUYZ9 GE/PDG/IND/EN/DEO/CI/CDIM 2022-09-05 2999-12-31
HUYZ9 GE/PDG/IND/EN/DEO/CI/CRM 2022-09-01 2022-09-04

 

We have users with the column MAT, that changed Affectation
The business users wants to have the latest Affection
All these infos are in the same table.

 

I need help please.

 

 

Labels (1)
3 Replies
BrunPierre
Partner - Master II
Partner - Master II

With this front end expression

Aggr(FirstSortedValue([affectation date end],-[affectation date end]),MAT)

BrunPierre_1-1667414673320.png

cedfoning
Creator
Creator
Author

hello @BrunPierre 

thanks for your anwser
i wanted to do it in the script, and i did something like this :

LOAD Mat,

FirstSortedValue([affectation date end],-[affectation date end]) as indivsmallest,

Resident Temp

Group By Mat;

 

But not working. it gives me Null values

 

BrunPierre
Partner - Master II
Partner - Master II

Hi @cedfoning,  perhaps with the code below.

Temp:
LOAD MAT,
Affectation,
[affectation date start],
[affectation date end]

FROM DataSourceTable;

Data:
LOAD MAT,
Maxstring(Affectation) as Affectation,
Max([affectation date start]) as [affectation date start],
FirstSortedValue([affectation date end],-[affectation date end]) as indivsmallest

Resident Temp
Group By MAT;

DROP Table Temp;

EXIT SCRIPT;