Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
JustSomeGuy
New Member

Power Query SDK - Naming the Output Query

I created a custom connector for PowerBI using the Power Query SDK. When I run it in PowerBI the result is always "Query1" (for the frist one, Query2 for the second, etc.).

Is there any way I can set the naming schema of the query using the SDK?

6 REPLIES 6
sangameshks
Helper I
Helper I

@JustSomeGuy I told you  about the default query names. We can request Microsoft for this feature. isnt it?

sangameshks
Helper I
Helper I

In Power Query SDK, the default query names like "Query1" and so on. it doesn't provide a direct method to set a custom naming schema for these queries programmatically. You can choose Power BI Desktop. 

 

I am sharing you 2 document likes so that it can assit you further

 

SDK Dcumentation : https://learn.microsoft.com/en-us/power-query/install-sdk

SDK in Vs Code: https://learn.microsoft.com/en-us/power-query/power-query-sdk-vs-code

ZhangKun
Super User
Super User

the query must from Navigation Table, you can see this link: NavigationTable.pq 

Thank you for the suggestion, but I tried the code in the link and the outcome still says "Query1".

Maybe your code is wrong, or I misunderstood your problem. Here are the code and screenshots.

 

shared TestRename.Contents = (optional message as text) =>
// START!!!!


    SampleTable();

SampleTable = () => 
    let
        objects = #table(
            {"Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf"},
            {
                {"JustSomeGuy", "item1", #table({"Column1"}, {{1}}), "Table", "Table", true},
                {"Item2", "item2", #table({"Column1"}, {{2}}), "Table", "Table", true}
            }
        ),
        NavTable = Table.ToNavigationTable(objects, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
    in
        NavTable;
Table.ToNavigationTable = (
    table as table,
    keyColumns as list,
    nameColumn as text,
    dataColumn as text,
    itemKindColumn as text,
    itemNameColumn as text,
    isLeafColumn as text
) as table =>
    let
        tableType = Value.Type(table),
        newTableType = Type.AddTableKey(tableType, keyColumns, true) meta [
            NavigationTable.NameColumn = nameColumn,
            NavigationTable.DataColumn = dataColumn,
            NavigationTable.ItemKindColumn = itemKindColumn,
            Preview.DelayColumn = itemNameColumn,
            NavigationTable.IsLeafColumn = isLeafColumn
        ],
        navigationTable = Value.ReplaceType(table, newTableType)
    in
        navigationTable;


// END!!!!!
// Data Source Kind description

 

After generating the extension and loading it into Power BI and clicking on it in the connector list:

ZhangKun_1-1734011792334.png

After clicking the OK button:

ZhangKun_2-1734011849667.png

 

Anonymous
Not applicable

Hi @JustSomeGuy ,

I checked the official documentation, but it seems that there is no way to set it. You might try to define the name yourself:

let
    Query1 = YourQueryFunction1(),
    Query2 = YourQueryFunction2()
in
    Record.FromList({Query1, Query2}, {"Query1", "Query2"})


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.