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.
I have been using the Table.AddKey function in Power Query to define primary and foregin keys using both Power BI Desktop and Power BI Dataflows. After getting more lines than expected after a merge based on columns having the keys defined I understod that creating a primary key, e.g.
Table.AddKey(Table, {"BK1", "BK2"}, true)
there is no check that the combinations of BK1 and BK2 are unique i the table. Defining a primary key on a column combination that is not unique shall generate a runtime error, or am I wrong? If not, what is then the differense in using true/false as the third argument. I.E. in the query below, the ID is not unique and there shall be a runtime error generated
let
tableType = type table [Id = Int32.Type, Name = text],
table = Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 1, Name = "Good Bye"]
}),
resultTable = Table.AddKey(table, {"Id"}, true)
in
resultTable
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.