When you create the query where you choose both stores and the product and create a crosstab, you will also get results where one store sold something, and the other did not.
![table with all values](http://users.skynet.be/binabik/blog/top_table_ab.jpg)
This picture shows what happens. There are occurences where one store sold something, and the other did not. Business Objects then shows “discontinued”.
![table continued](http://users.skynet.be/binabik/blog/top_table_ab_cont.jpg)
The solution I found, is situated at the query level, and includes a combination of subquery’s and union query’s.
First, I created a query where I specify my first source :
![first source](http://users.skynet.be/binabik/blog/query1_ab.jpg)
it includes the name of the stores, the number of the product and the sales revenue. All of this is done using the eFashion universe, interesting for demonstration purposes only. The real work goes on in the conditions.
Storename and year are filtered as usual.
SKU number is filtered using a subquery. in this case, listing only the SKU numbers that are the result of that subquery.
The subquery looks like this :
![first subquery](http://users.skynet.be/binabik/blog/subquery1_ab.jpg)
The result of this query is a list of all SKUs sold in the other store. So we only get products in store A that have been sold in store B.
It is now possible to select both stores, but if we do that, then we will get some products for store B that were not sold in store A.. so not a good idea.
Next, we need to create a Union query, to also show data about the second store.
Click the
![union query icon](http://users.skynet.be/binabik/blog/unionquery.gif)
![solved](http://users.skynet.be/binabik/blog/table_ab_solution.gif)