Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I'm making a custom connector that consumes a rest API to create for tables that are in a linear way. The thing is that everytime the user loads the tables he needs to created the relationships by hand, so I'm trying to create the relationships from code using Power Query M to save time to my users. Is there an equivalent of MySQL's in Power Query M of this:
FOREIGN KEY (locationID) REFERENCES Locations(id)
So, my tables (reducing the example to only two tables):
let
Locations= #table(
{"id", "location", "state","zipCode"},
{
{1, "Tehuacan", "Puebla","7200"},
{2, "Santa Ana", "Tlaxcala", "90300"},
{3, "Tijuana", "Baja California","22400"}
}
),
KeysTagged = Table.AddKey(Locations, {"id"}, true)
in
KeysTagged
let
Products= #table(
{"id", "date", "product","quantity","revenue","locationID"},
{
{1, "2/8/2023 9:30:10 PM", "Zapatos",10,5000,2},
{2, "4/18/2023 8:24:12 PM", "Cinturones",10,5689,2},
{3, "8/12/2023 4:08:23 PM", "Tennis",10,3467,3}
}
),
KeysTagged = Table.AddKey(Products, {"id"}, true)
in
KeysTagged
so I'm trying to create the relationships from code using Power Query M to save time to my users
Power Query does not have such a concept. All partitions are independently loaded into VertiPaq.
What you can do is name the join columns the same and hope for Power BI to make the right guesses.
You can also experiment with Table.AddKey and Table.Keys to help with the suggestion.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |