Forum Discussion

mattmalone's avatar
mattmalone
Frequent Visitor
6 years ago
Solved

Many-To-One Relationship not being recognised

Hi all,

 

I originally posted the below into an older thread - https://community.powerbi.com/t5/Desktop/Forced-to-use-many-to-many-relationship/m-p/789053#M379986 so apologies if posting this again upsets anyone.

 

The issue - I cannot create a one-to-many relationship between my Product table (which has a Primary Key field - SKU) and my Sales Transaction Table. 

 

No doubt I'm going something wrong as today is the first day that I'm really working with Power Query.

 

  • I've looked to filter out Null values in my Product List.

    = Table.SelectRows(#"Removed Columns", each [StockCode] <> null and [StockCode] <> "")

    I also created a calculated field to run an If, Then to see if anything came up positive for a null value. No positive results.

  • I've run another query to see if there are any duplicate values by Transform -> Group By ->Stockcode Count. No values greater than 1.

  • My only other guess (as I'm new to Power Query) is if there is an issue with a particular operator (@ being used in a SKU, for example) and if there are particular operators that may impact on being able to create a many-to-one relationship.

  • The transaction Table will have duplicate product codes and have duplicate order numbers due to the fact that one sale will have multiple lines and can have the same SKU appear against that transaction twice. This is obviously the many side of my relationship and I couldn't think why this would impact on anything. I added an Index in the table just to see if that would play a factor and it obviously didn't.

It's my first day getting really into Power, and I'm ssooo close yet sooo far!

  • Hello all,

     

    This particular query was difficult to resolve but got there in the end. Duplicates were not easy to find because they had a return carriage in them.

     

    One SKU in a DB of 94,000 records.

     

    Regards,

3 Replies