cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elijah2018 Regular Visitor
Regular Visitor

Automatically change table names when Query is executed

Hi everyone, 

 

So I gather data using a function in Power Query that has as an input the table name of the table I want to download. 

The problem that I have is that the resulting table name will be ''Invoked function'', ''Invoked function(2)'' , ... etc. 

I could always change the table names manually but I would like to have it changed automatically to the name of the table that I gave the function. 

 

Is this possible ? 

 

Thanks in advane for your help 

 

Elijah 

5 REPLIES 5
Community Support Team
Community Support Team

Re: Automatically change table names when Query is executed

Hi elijah2018 ,

 

Please check if you have create a table or just a custom function. If you have create a table, you can rename it by click "Source" step and change the name. If you have create a custom function, there's no table exists. If you still have doubt, for further analysis, could you post your table structure or custom function in your PBIX?

 

Regards,

Jimmy Tao

elijah2018 Regular Visitor
Regular Visitor

Re: Automatically change table names when Query is executed

Thank you Jimmy ( @v-yuta-msft ) for your interest in helping me. 
I am very new to Power BI and  have probably just created a custom function and therefore not created a real table.
I will try to explain what I have created. 

 

I have a function called GetData having the following structure; 

 

let
Source = (datapoint as text) as table =>

    let
    Source = Csv.Document(Web.Contents("www.mydatasource.com/" & datapoint),[Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.None])
   in Source

in
Souce

So the function takes datapoint as argument and downloads the content using Web.Contents. 
The result is a table (?) called invoked function and if I rename the table I cant see any code generated in the ''advance editor'' . 

What am I doing wrong ? 


Thanks again

Community Support Team
Community Support Team

Re: Automatically change table names when Query is executed

Hi elijah2018,

 

Here are my steps:

1. Create a blank query and paste your code, then apply. This is a function which can be invoked, not a table.

2. Input parameter (e.g.: "products.html") then click invoke, the function can generate a table, then right click on the table and you can rename it.

 

See screenshots and PBIX here: https://www.dropbox.com/s/69844sipmc6rqfg/Automatically%20change%20table%20names%20when%20Query%20is....

捕获.PNG 

 

Regards,

Jimmy Tao

elijah2018 Regular Visitor
Regular Visitor

Re: Automatically change table names when Query is executed

Hi again Jimmy ( @v-yuta-msft ), 

What I would like to do is to skip the ''click on the table to rename it step'' . I would like Power Query to automatically change the name of the table to for e.g the datapoint I had as an input to the function. 

 

Is this possible ? 

 

Regards

Elijah

Community Support Team
Community Support Team

Re: Automatically change table names when Query is executed

Hi elijah2018,

 

I'm afraid power query doesn't have this feature, you can submit your idea here: https://ideas.powerbi.com/.

 

Regards,

Jimmy Tao

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)