Lasselakan
New Member
- Joined
- Feb 3, 2014
- Messages
- 3
I have a problem that I've not seen any example of how to solve regarding PowerPivot and Pivot Tables. I have 3 tables; stores, visitors and store_competitors.
'stores' looks like this:
store_id, store_name
'visitors' looks like this:
visitor_id, visited_store_id
'store_competitors' looks like this:
store_id, competing_store_id
Now I want to be able to pick a 'stores'.store_name (e.g. in a slicer) and then illustrate how many visitors each of that store's competitors has had. The problem is that I cannot add Relationship between 'visitors' and 'store_competitors' on visited_store_id = competing_store_id since both columns can contain duplicates (a store can have many visitors and many competitors). I can however create a Relationship from each of these to 'stores'.store_id but that doesn't give proper result, it acts as if the Relationship doesn't "reach" all the way from 'visitors' to 'store_competitors' (i.e. if I slice on a specific 'store_competitors'.store_id then COUNT('visitors'.visitor_id) is not properly limited to the competitors of that store, but instead shows all stores in the whole table and shows counts as 0 for everyone and Excel also suggests that a relationship might be needed. I guess it's asking about a relationship between 'visitors' and 'store_competitors' but how can I add that if both columns have duplicates?)
Here is a more specific example with example data:
'stores'
10 storeX
11 storeY
'visitors'
20 15
21 15
22 16
'store_competitors'
10 15
11 15
11 16
If I pick storeY in the slicer I want to see the result as competing_store_id(15) had 2 visitors and competing_store_id(16) had 1 visitor.
Please give me a hand on this one. I'm familiar with SQL but find PowerPivot a bit tricky in some aspects like this one...
'stores' looks like this:
store_id, store_name
'visitors' looks like this:
visitor_id, visited_store_id
'store_competitors' looks like this:
store_id, competing_store_id
Now I want to be able to pick a 'stores'.store_name (e.g. in a slicer) and then illustrate how many visitors each of that store's competitors has had. The problem is that I cannot add Relationship between 'visitors' and 'store_competitors' on visited_store_id = competing_store_id since both columns can contain duplicates (a store can have many visitors and many competitors). I can however create a Relationship from each of these to 'stores'.store_id but that doesn't give proper result, it acts as if the Relationship doesn't "reach" all the way from 'visitors' to 'store_competitors' (i.e. if I slice on a specific 'store_competitors'.store_id then COUNT('visitors'.visitor_id) is not properly limited to the competitors of that store, but instead shows all stores in the whole table and shows counts as 0 for everyone and Excel also suggests that a relationship might be needed. I guess it's asking about a relationship between 'visitors' and 'store_competitors' but how can I add that if both columns have duplicates?)
Here is a more specific example with example data:
'stores'
10 storeX
11 storeY
'visitors'
20 15
21 15
22 16
'store_competitors'
10 15
11 15
11 16
If I pick storeY in the slicer I want to see the result as competing_store_id(15) had 2 visitors and competing_store_id(16) had 1 visitor.
Please give me a hand on this one. I'm familiar with SQL but find PowerPivot a bit tricky in some aspects like this one...