Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
yipchunyu
Creator
Creator

Running count (title for 3 continuous months)

Like normal company, our staffs will be promoted (or demoted) from time to time.  Any way to get the latest title which has been effective for more than 3 months?

NameJanFebMarAprMay
Staff 1AMAMAMAMAM
Staff 2RMRMRMSRMSRM
Staff 3BMBMSBMSBMSBM
Staff 4AMMMMM
Staff 5RMRMRMSRMRM

 

For example, assuming it's May now
Staff 1 should be AM
Staff 2 still be RM (since he only be SRM for 2 months)
Staff 3 will counted as SBM (as his title has been effective for 3 months)
Staff 4 will counted as M (as his title has been effective for more than 3 months as well)
Staff 5 will counted as RM (as latest 3 continuous month's title is RM)
The requirements are a little bit wired but it's what I need to handle.  Pls share your ideas.  Thx in advance.

1 Reply
anushree1
Specialist II
Specialist II

Use the below Script:

Temp:
CrossTable(Month,Designation)
LOAD
Name,
Jan,
Feb,
Mar,
Apr,
May
FROM<<Table Name along with path>>;

Table1:
Load * ,
if(peek(Name,-2)=Name,'Apt','NA'),
if(peek(Name,-2)=Name and peek(Designation,-2)= Designation,peek(Designation,-2)) as CurrentDesignation;
Load *
Resident Temp
order by Name;
Drop Table Temp;

Create a table with Name And Designation in the front end to get the desired result