Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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. 

  • Anonymous's avatar
    Anonymous
    6 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

    • Anonymous's avatar
      Anonymous
      Not 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's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity 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?

      • Anonymous's avatar
        Anonymous
        Not 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.