I am trying to set up a primary key on my table but the “Key column” dropdown selection keeps giving me an error stating (correctly) that there is a space in the column and I can’t build a primary key column because of the space.
So, I’m thinking that the next thing to do is to remove all rows with a space in only 1 column, ignoring if there are spaces or nulls in the other columns.
- I import the csv file
- Go to Model View
- Select the imported file that is presented as a table
- Here’s where I want to assign a Primary Key
- So I select the table’s Properties -> Key Column,
- I select the ‘Hub Site/CLLI’ column from my table on the dropdown box.
- But I get the following error:
“Column ‘Hub/Site CLLI’ in Table ‘Power BI Hub CLLI’ contains blank values and this is
not allowed for columns on the one side of the many to one relationship or for columns that are used for primary key of a table. (Hub Site CLLI(156)).”
- I go to the Data View screen and confirm that there is a row with a blank (space) value in the ‘Hub/Site CLLI’ column.
So, I believe the fix is to first remove the row that has a space (or null) value in the specific column named ‘Hub/Site CLLI’. Then assign the primary key to that column.
There are other columns with spaces or null values in them, but I do not want to remove rows if these are found. I only want to remove the row if the specific column named ‘Hub/Site CLLI’ has a space or null in its column.
Also, I need to make sure this is done each time the table is refreshed since there can be other spaces or nulls in the column in future refreshes.
I’ve been looking at tons of Youtube videos that show how to remove rows with columns with nulls or spaces BUT they all show how to remove rows with multiple columns with spaces. I only want to look at the one column named, ‘Hub/Site CLLI’ and ignore all other columns.