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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
lucasx15
Contributor III
Contributor III

Creating a flag for the last two months

Hello everybody, I'm new to qlikview,
I need to create a flag field for customers who have used the same product in the last two months.


in my load, I created a temporary table and thought of using the peek function, for her to check and create the flag for me. However, it's not working:

 

TEMP__1:
LOAD NR_CLIENT,
	 DT_INT_DISP,
	 DT_FINISH_DISP,
	 RowNo()
RESIDENT CLIENT_PRODUCT_DISP
WHERE NR_SEQ_PRODUCT=1
ORDER BY NR_CLIENT,
		 DT_INT_DISP ASC;


TEMP_2:
LOAD NR_CLIENT,
	 DT_INT_DISP,
	 DT_FINISH_DISP,
	 IF(NR_CLIENT=PEEK(NR_CLIENT),
		IF(DT_INT_DISP-PEEK(DT_FINISH_DISP),-2)'YES','NO'),'NO') AS FL_CLIENT_2,
		ROWNO(),
		Resident TMP_1
Order by NR_CLIENT, 
		 DT_INT_DISP ASC;

 

Labels (1)
0 Replies