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
klammymaster
Frequent Visitor

Relationship and Unique Values

Hi there,

 

I have a 2 files with many entries trying to relate them together via email addresses. When I try relating the 2 together, I get an error "You can't create a relationship between these two columns because one of the columns must have unique values".  1 file has over 40,000 rows and the other has about 7000.

 

So far I've done: Removed errors, trimmed text, removed blanks, removed nulls, lowercased cells, tried both CSV and XLSX file formats, and created a new query with all of the emails to make it a middle of the relationship.

 

 I've been stuck with this issue for 2 days now and can't figure out what I'm doing wrong. 

1 ACCEPTED SOLUTION

Hi @klammymaster

 

Here is a DAX Soluction for creating a slicer table that will have unique values that you can create relationships too.

 

Then use the field in this table for your slicers

 

Slicer Table = 
    DISTINCT(
        UNION (
            ALL('biibuserdata'[biibEmail]) ,
            ALL(Intune[Email address])
            )
            )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

14 REPLIES 14
Anonymous
Not applicable

This seems to be a very common frustration, so I have posted some additional info in a similar thread: https://community.powerbi.com/t5/Desktop/Can-t-create-a-relationship-between-two-columns-because-one...

zenmemo
Helper I
Helper I

@klammymaster so you created a bridge table (removing the duplicate emails) and still you weren't able to connect to the original tables as one-many relationship?

Hi @zenmemo,

 

This is the video that I followed: https://www.youtube.com/watch?v=vAvQ8pCnWDk

I was not able to connect anything to the tables with the new table.

@klammymaster, well if your bridge table is void of dupl or null values, it should work. here's an example.

 

Table.JPG

 

Connection.JPG

 

dash.JPG

Hi @zenmemo,

 

Yes that's exactly what I'm trying to do but I'm not sure why it's not working. Attached are the steps I've done to remove the blanks, errors, null, and etc.

 Capture.PNG

@klammymaster, I don't see that you filtered against null values or removed dupl. That would also contribute to the non-unique value error.

 

null.JPG

 

remove duplicates.JPG

 

Hi @klammymaster

 

Here is a DAX Soluction for creating a slicer table that will have unique values that you can create relationships too.

 

Then use the field in this table for your slicers

 

Slicer Table = 
    DISTINCT(
        UNION (
            ALL('biibuserdata'[biibEmail]) ,
            ALL(Intune[Email address])
            )
            )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Where do I put the DAX formula? I tried creating a new measure and column and that didn't work. I also tried to create a Slicer Table but I'm not sure where to put the formula. 

HI @zenmemo

 

On the Modeling Tab of Power BI Desktop, you should see a New Table button.  Click this and paste my code into the formula bar

 

image.png

This should create a table that will be visible in the Relationship View where you can create relationships to it from your existing tables.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

You're amazing. Thank you so much for your help 🙂 Appreciate it a lot.

Phil_Seamark
Employee
Employee

HI @klammymaster

Are you expecting the email addresses to be unique in one of the files?  Or can the same email naturally occur more than once in the tables?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

The same emails will occur more than once in the smaller file. The smaller file contains eletronic device assignments and 1 user can have multiple devices. The bigger file is a gigantic list with all users. Please let me know if I can give you more detail.

Hi @klammymaster

 

WHat is the name of your two tables, including the names of the columns that have the email addreses?

 

I can give you a formular for a calculated table that you can use as a slicer.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Table 1 is "biibuserdata" with the column name "biibEmail". Table 2 is "Intune" with the column name "Email address". 

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.