Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
anat
Master
Master

how to get common records in current and previous year

Team,

my source data:

Id,Name,Year

1,a,2015

2,b,2015

3,c,2015

1,a,2014

4,d,2014

3,c,2014

1,a,2013

5,d,2013

6,c,2013

my requirement is

1)when i select 2015,then it should compare with previous year(2014) and display common Id column records in 2 years.(here 1,3 are common in 2015 and 2014)

2)when i select 2014,then it should compare with previous year(2013) and display common Id Column records in 2 years.(here 1 is common in 2014 and 2015)

Regards

.......

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached example.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

See attached example.


talk is cheap, supply exceeds demand
qlikviewwizard
Master II
Master II

Hi gwassenaar

It is showing right results. But the why the below formula showing incorrect, I think.

Please correct me if I am wrong. Thank you.

=sum({$<Name*=p({<Year={'$(=max(Year)-1)'}>}Name)>}1)

Capture.JPG

Gysbert_Wassenaar

That's a bug in the syntax checker of the expression editor. It doesn't understand that *= means to calculate the intersection of the default set with the set calculated with the p() function


talk is cheap, supply exceeds demand
qlikviewwizard
Master II
Master II

Thank you Gysbert.

anat
Master
Master
Author

Thank you Gysbert.

how to implement same in like a clickable object like by clicking button or by clicking text object.