Forum Discussion

finnprice's avatar
finnprice
Regular Visitor
1 year ago
Solved

One-to-Many Relationship with Null Value

Hello All,

 

I hope you are well!

 

I am looking to create a one-to-many link between two tables (Mastertable and Project_Table) based on a column entitled "Project Code."

 

Mastertable has the project code as well as other information on the project such as opportunity name, contact, lead source, type of project, etc. Mastertable does not contain any financial data.

 

Project_Table on the other hand only has three columns, the opportunity name, the project code and the opportunity amount.

 

My goal is to link the financial data to my Mastertable using a a one-to-many match based on the project code. However, not every opportunity is assigned a project code at the same time. So, my Project_Table has multiple null values under the project code column because of timing differences. As I try to create the link between tables, I am running into an error where the project_table "contains a duplicate value 'Null'." Is there a way to have the one-to-many link ignore rows with nulls in the project code column or do I need to clean the data better at the source?

 

Any tips/suggestions are welcome! Thanks in advance 🙂

 

P.S. data is confidential so I can't provide any datasets but can answer any questions if the two table setup isn't clear.

 

  • Hello finnprice 

     

     Go to Project_Table in Power Query Editor.

     Add a step to filter out rows where Project Code is null:

    powerquery

    Table.SelectRows(Project_Table, each [Project Code] <> null)

     

    or

    via UI

    Click the dropdown on Project Code column

    Uncheck (null)

     Apply and Close → Now the relationship will create without error

     

    Thanks,
     Pankaj Namekar | LinkedIn

2 Replies

  • Ashish_Excel's avatar
    Ashish_Excel
    Icon for Solution Supplier rankSolution Supplier

    Hi,

    In Power Query, filter the project code column to remove all blanks/nulls.

  • Hello finnprice 

     

     Go to Project_Table in Power Query Editor.

     Add a step to filter out rows where Project Code is null:

    powerquery

    Table.SelectRows(Project_Table, each [Project Code] <> null)

     

    or

    via UI

    Click the dropdown on Project Code column

    Uncheck (null)

     Apply and Close → Now the relationship will create without error

     

    Thanks,
     Pankaj Namekar | LinkedIn