Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RobertGilbert
Regular Visitor

Table Joins

I have a table of unique values (combined key of customer and material), no other values in that table. I have sales table with that key also, but obviously not unique.  There are about 12 million rows of sales data and 3 million unique entries in my customer/material table.  When trying to, join, I get the message that at least one table must have unique values.  I have validated multiple times, and the customer/material entries are unique.  What is happening?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RobertGilbert

 

I understand you are sure that the values in dim table is unique. Can you try create a new calculated table and try joining this with your fact table for testing purpose? ( Go to Modelling -> New Table-> Use this formula)

 

Table =
FILTER (
    DISTINCT (
        SELECTCOLUMNS ( CustomerTable, KeyColumn, CustomerTable[KeyColumn]  )
    ),
    ISBLANK ( CustomerTable[KeyColumn]) = FALSE ()
)

 

Thanks
Raj

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @RobertGilbert,

there seems a duplicate values of the combined key in your dimension table.

While loading can you try loading select distinct combinedkey from dimensiontable  and see if you still get this error?

I am not understanding how to 'select distinct combinedkey'.  I have one field in the file, which already has key combined, prior to uploading file to Power BI.  I have tried 'Remove Duplicates' and that does not help.  If there were duplicates for the key, since the key is the only field in that file, it should resolve.  After getting this to work, I plan to add 2 more columns which split the key.

Anonymous
Not applicable

it seems you said you have a table of unique values with combinedkey and when you are loading the table can you load the distinct records using the SQL?

if you cant figure it out try uploading the dimension table data in here to get a better help.

I believe you are still not quite understanding me.  I know that the customer/material file, which contains 1 field is unique.  There are 3,356,863 entries in this file.  I am trying to join it with our sales data file, which has the same key and has about 12,000,000 entries.  Now, you may ask why combine a file with one field to another file which contains that same field.  The truth is, there should be other fields in the customer/material file, however, until I can get this combine issue resolved, I am not placing them there.

Anonymous
Not applicable

Hi @RobertGilbert

 

I understand you are sure that the values in dim table is unique. Can you try create a new calculated table and try joining this with your fact table for testing purpose? ( Go to Modelling -> New Table-> Use this formula)

 

Table =
FILTER (
    DISTINCT (
        SELECTCOLUMNS ( CustomerTable, KeyColumn, CustomerTable[KeyColumn]  )
    ),
    ISBLANK ( CustomerTable[KeyColumn]) = FALSE ()
)

 

Thanks
Raj

Rajen,  This process worked, and also uncovered the underlying issue.  I have many entries that are 'near' duplicates.  Where the first character is a 'space' or not, and the rest is the same, example " 12345" and "12345".  Now, even doing a 'trim' and 'remove duplicates' did not resolve, however your neat DAX trick below with creating new tables did.  I was given the clue as to what the issue was, when I saw that these records were missing, so now only "12345" rather than both.

 

Thanks Much

Bob Gilbert

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.