Each person in the database can be known for certain titles (moving pictures/movies).
We need to “normalize” these “known for” titles by creating a new table and putting all of the people and their titles in that table. The first column will have the Id of the person and the second column will have an Id of the title. If a person is known for two titles, we will store that in two rows. This two-column table does not have a column that contains a primary key. However, the combination of the name Id and the title Id will be unique.
let Source = namebasics, #"Removed all columns except nconst and knownFor" = Table.RemoveColumns(Source,{"primaryName", "birthYear", "deathYear", "primaryProfession.1", "primaryProfession.2", "primaryProfession.3", "knownForTitles.1"}), #"Unpivoted knownForTitles" = Table.UnpivotOtherColumns(#"Removed all columns except nconst and knownFor", {"nconst"}, "Attribute", "Value"), #"Removed Attribute column" = Table.RemoveColumns(#"Unpivoted knownForTitles",{"Attribute"}), #"Renamed Value column to KnownForTitles" = Table.RenameColumns(#"Removed Attribute column",{{"Value", "KnownForTitles"}}) in #"Renamed Value column to KnownForTitles"
Below is a screenshot of our new table. Notice that the first person, who is Fred Astaire, is known for three titles.