Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
boris_nechaev
Contributor III
Contributor III

Intersection of two fields.

Hello!

I load two fields with IDs: id1 and id2. Each of the fields also has date dimension (date1 and date2) associated with them. I need to write an expression that given the current date1 and date2 selection will count number of IDs that are in both ID fields. I could also use an expression that finds the difference between the fields, i.e. IDs that are in id1, but not in id2.

If the above is unclear, here is an example.

date1id1
11/19/20111
11/19/20112
11/19/20113
11/19/20114
11/20/20115
11/20/20119

date2id2
11/23/20111
11/23/20113
11/23/20114
11/23/20117
11/23/20118
11/25/20119

In the list box for date1 I select "11/19/2011", which leaves IDs {1, 2, 3, 4} in id1. In the list box for date2 I select "11/23/2011", which leaves IDs {1, 3, 4, 7, 8} in id2. I need expressions that will return 3 as the number of IDs present in both fields ({1, 3, 4}) and 1 as the number of IDs present in id1, but not present in id2 ({2}).

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

=count({<id1 *= p(id2)>} id1)

and

=count({<id1 /= p(id2)>} id1)

Regards,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

Try

=count({<id1 *= p(id2)>} id1)

and

=count({<id1 /= p(id2)>} id1)

Regards,

Stefan

boris_nechaev
Contributor III
Contributor III
Author

Thanks, worked like a charm!