Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
agni_gold
Specialist III
Specialist III

Find intersection between previous values

Hi Friends,

I have one situation ,

I have below data for Month and ID

   

MonthIDRequired_Output
Dec-153 null
Jan-163 null
Feb-1633
Mar-164null
Apr-164null
May-1644

Now i want each row should  compare its previous 3 rows and find intersection value , i have placed required output in one column.

Example : For Feb-2016  , it will compare Dec-2015,Jan-2016 and Feb-2016 any ID: 3 is common in between , so 3 should return in front of Feb-2016 , else null

11 Replies
vinieme12
Champion III
Champion III

See attached

FACT:

LOAD Month,

  ID,

  Month&'_'&ID as KEYField

FROM

(ooxml, embedded labels, table is Sheet1);

left join(FACT)

Temp:

LOAD

ID,

ID as FLAG,

MAX(Month)&'_'&ID as KEYField

Resident FACT

Group by ID;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

in Straight table you can try

=if(ID = Rangesum(above(ID,0,RowNo()))/3,ID,0)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
agni_gold
Specialist III
Specialist III
Author

But here i am not getting any intersection.

vinieme12
Champion III
Champion III

Not sure, what if?

MonthIDRequired_Output
Dec-153null
Jan-163null
Feb-1633
Mar-164null
Apr-165null
May-165?
Jun-164?
Jul-164?
Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
agni_gold
Specialist III
Specialist III
Author

Yes this i want , but it is not happening.

Can you please share app with set analysis. 

vinieme12
Champion III
Champion III

what should be the output here?

what if?

MonthIDRequired_Output
Dec-153null
Jan-163null
Feb-1633
Mar-164null
Apr-165  ??
May-165??
Jun-164??
Jul-164??
Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
agni_gold
Specialist III
Specialist III
Author

Please see below

MonthIDRequired_Output
Dec-153null
Jan-163null
Feb-1633
Mar-164null
Apr-165  null
May-165null
Jun-164null
Jul-164null
vinieme12
Champion III
Champion III

OK, try the below

FACT:

LOAD Month,

  ID,

  if(RangeSum(ID,Peek(ID),Peek(ID,-2))/3=ID,ID,null()) as Flag

FROM

(ooxml, embedded labels, table is Sheet1);

245504.JPG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
agni_gold
Specialist III
Specialist III
Author

Can we do it on front end , in set analysis ?