I see two possibilities to solve this.
Two Queries and Merging
Build two queries so that each query returns only the data from each period. I will use the e-Fashion universe with Year as my period. And yes, my e-Fashion data is old.
Those queries yield the following results…
Now merge on the Store name. You would merge on your ID. Then create a variable based on the Year from my first query with the Qualification set to “Detail” and the Associated dimension set to the merged “Store name”.
Do the very same thing for the Year from the second query.
Next create a table with your merged dimension and filter on these two variables where they are not null.
There you have it. The Store name that is in both periods…
With this foundation you can also show the Store names that are in one period and not the other by changing the “Is not Null” filter on one of the variables to “Is Null”.
This approach is more straightforward. It is all right here in the query. If you need to know how to create a subquery here is a start.
And here are the results…
If you want the Store names in one period and not the other you just need to adjust the “In List” operator for the Store name to “Not In List”.
Both of these methods provide the same basic results with varied effort, complexity, flexibility, and format (one row per ID vs. one row per period). You choose whatever works best for you and most importantly what you understand.