Forum Discussion
bi-directional relationship doesn't work
Hi,
I'm learning bi-directional relationship and created a small model as below.
my fact table is a sales table, which is linked to product dimension table. My objective is count the no. of products (by product codes) sold each day. So I created a measure as below
product count=countrows('product').
I then added a pivot table with sales[Order Date] in the row and [product count] in the value field. It doesn't work, PB only gives total product count in the pivot, instead of count by day.
- Anonymous6 years ago
I found out the reason. It looks the primary key has been changed when I reloaded the product table to the model. I had meant to link sales table (sub category) to product table (sub category), but PB linked the two tables via different columns due to auto relationship detection.
I'm a bit embarressed about the kind of mistake. I guess it will take me a bit time to get used to the way PB works.
Thanks all the same for the suggestion. I would probably have given up on this has there not been the discussion in the forum.
6 Replies
- amitchandak
Super User
Anonymous , I tried the same in my file. And It is working.
Check Bi-directional page in my file after signature
I think you should check if the interaction is off
https://docs.microsoft.com/en-us/power-bi/create-reports/service-reports-visual-interactions
Or Are you using ALL /Allselected in formula
- AnonymousNot applicable
I checked interaction - that doesn't seem to be the reason. I don't use all function neither. Below is the pivot table that I have problem with.
I would like to share the pbix file here. Unfortunately, I don't have the right to attach files here.
- Greg_Deckler
Community Champion
Anonymous What you are doing should work, can you share your PBIX file by putting it up on OneDrive or Box and sharing a link?
- AnonymousNot applicable
Here is the link to the pbix file
https://www.dropbox.com/s/opzg91d1ezc1qey/relationship%20test2.pbix?dl=0
- AnonymousNot applicable
I found out the reason. It looks the primary key has been changed when I reloaded the product table to the model. I had meant to link sales table (sub category) to product table (sub category), but PB linked the two tables via different columns due to auto relationship detection.
I'm a bit embarressed about the kind of mistake. I guess it will take me a bit time to get used to the way PB works.
Thanks all the same for the suggestion. I would probably have given up on this has there not been the discussion in the forum.