Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist
Specialist

Above funcation query

Hi,

 

I have below table data, for each employee different Department and and position change change.

EMP_ID DEPARTMENT POSITION_DATE
2001 Accountant 1/1/2007
2001 Finance 8/31/2014
2001 IT 6/7/2018

 

I need to consider previous  position date if the selected date is not equal to postion date.

for example - If I select  any other date such as 2/18/2022 then it should consider latest previous record 

2001 IT 6/7/2018

 

And if I select 4/20/2017 then it should consider 

2001 IT 6/7/2018

 

Kindly assist.

 

Regards,

Mahamed

Labels (1)
5 Replies
Aditya_Chitale
Specialist
Specialist

try this in backend script:

test:
load * Inline
[
emp,dept,date
2001,accountant,1/1/2007
2001,finance,8/31/2014
2001,IT,6/7/2018
];


NoConcatenate

test2:
load *,
peek(date) as Prev_date
resident test order by date asc;

drop table test;

 

You will get previous record against each date when viewed in frontend table chart and will also work on selections.

 

Regards,

Aditya

Mahamed_Qlik
Specialist
Specialist
Author

Hi Aditya,

Thanks for the response.
Here what I am getting the same dates, instead I need its previous date.

Mahamed_Qlik_0-1669097262793.png

 

Aditya_Chitale
Specialist
Specialist

make sure you have used 'order by'. I got below table using same solution:

Aditya_Chitale_0-1669098380160.png

Regards,

Aditya

 

Mahamed_Qlik
Specialist
Specialist
Author

Okay. What if I want use logic on frontend?

Mahamed_Qlik
Specialist
Specialist
Author

FYI...

dept is coming from different table and in your case you have added to inline table,
that could be the reason?