I am attempting to create a relationship between two tables. The trouble is, I have a relationship that should be 1 to 1. In the SharePoint site from which both tables are pulled, each list is set to "force unique values" on the Leader ID and Employee Name ID fields. So, there should never be a "Many" scenario.
However, when I try to set the relationship to 1 to 1, I get the following error.
I even attempted to set the "many" side of this to "remove duplicates (despite the fact that SharePoint should not be allowing duplicates).
What am I missing? Why would this not be allowed? Thanks so much for your help!
I had the same problem, but the issue for me was duplication of values. I had removed duplicates, but I didnt realize until later that "remove duplicates" in the query editor is case-sensitive. I was able to work around the issue by applying Text.Lower to the column first. Then when I removed duplicates on that, the duplicates were actually removed and the problem went away. Hope this helps.
I faced the same issue, I was sure, that I have all values unique, I checked it with the conditional formatting in excel, then I included Remove duplicates in the Power Query Editor, I also created the Group By column in Power Query Editor to display count of values - each row contained 1.
Finally I created the Card visual based on the measures TotalRows and DistinctRows - what a surprise - TotalRows<>DistinctRows!
How to find the duplicate values -> delete rows by rows in Excel and check the cards. After 10 minutes I found the problem - the space character after the string value
It makes of course unique value for conditional formatting, unique value for Power Query Editor, but not for the Edit relationship dialog!
After deleting this space character, the duplicate value appeared everywhere, so by deleting the duplicate row I could create the 1 to many relationship ...
I've been struggling too with this issue. I was trying to establish a 'many to one' relationship but was getting the same error. I found a solution though.
I went to "Edit Queries" and selected the table where the non-duplicated values resided (the 'one' side of the relationship). I right clicked on the column containing the key values and selected "remove errors". Doing this then allowed me to create the 'many to one' relationship.
Strangely though - there were no errors to correct. I checked this using the measures (Count row and Distinct Count) in the comments above and also using excel to confirm there were no duplicates or blanks.
Anyway - this might help someone!
I had a similar issue due to the output csv file from a source system having an additional blank row of null values after the data
Filtering this out at the query stage fixed the issue for me
I could have deleted the row but the outputs were refreshed automatically from the source system on a certain date
I had this issue and at first there was a data problem, but after the data problem was corrected I still could not change the relationship from one to many -> one to one. I deleted the relationship and recreated it and everything was fine. Seems like a minor Power BI bug.
I have the same issue when trying to use the related function on one table that only had one column.
I verified in Excel with a pivot and by trying to remove duplicates. There were none.
I took the suggestion from the other post and found that there was one more counted with count than distinct count (even though I edited the query only for distinct).
The difference was a single blank. I do not know where the blank comes from, but I added a step to the query which was removes the blank.
Then I set my relationship "one to one" and my related function worked.
Edit: for spelling and grammer.
nice work around, what interim step did you do to kill off the blanks?
my hunch is that this clunky drag-n-drop / click-n-join alterantive to old fashioned, hand typed SQL is going to end up being a dead end waste of time. entire companies exist to solve this problem, like Alteryx (NYSE:$AYX). Even tableau, which has a much better interface than power bi, doesn't really work for drag-n-drop joins as well as a good old fasioned pre-written sql query.
BUT --- if you can make it work in this interface --- then way more users in a given company of non-programmers can get to work. So, what is this work around?
The work around is to fix the underlying data (probably via an updated SQL query), delete the relationship, and then recreate the relationship.
I would suggest you create two measures to double verify whether [LeaderID] values are distinct in LeaderStandardWork table.
After create those two measures, please place them in two card visuals, if results are different, it means there are duplicate [LeaderID] values in LeaderStandardWork table.
In my opinion, if the [LeaderID] really has duplicate values, we can't set the relationship as 1-1, this could be the reason why the error throws out.
@v-qiuyu-msft I don't agree. What should I do if I have one table with Documents/Lengths and one table with Documents/Classifications, and I want a bar chart with average length per classification? A Document can have either none, one or multiple Classifications and each Classification is shown as a row.
What I want is to plot this:
That's strange, you wouldn't have some blanks in there or something? The only way that I could replicate this is when I had a blank cell in one of my tables.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!
Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!