Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hello friends, how are you? I'm having a problem with a dynamic data source and I've tried several alternatives, experimenting with different variations of the functions "Web.Contents", "Query", "Expression.Evaluate", "Text.FromBinary", but I've had no success. I looked for solutions in various videos, blogs (including Chris Webb's blog, which addresses some similar cases)... The code below is still considered a dynamic data source, which has made it very difficult to automatically update some reports. Could someone help me? If you try, you'll see that it's working perfectly, but PBI ends up considering the source to be dynamic.
// EPNTV001 - VCAD_Project Base2
let
// Defina as credenciais
User = "marcella.piceli@promon.com.br",
Password = "Hg6qNqeAquH2S2TZjn8J",
// Função para obter o token
GetToken = () =>
let
token_url = "https://flounder-amusing-moderately.ngrok-free.app/get_token",
token_response = Json.Document(
Web.Contents(
token_url,
[
Content=Text.ToBinary("user=" & User & "&password=" & Password),
Headers=[#"Content-Type"="application/x-www-form-urlencoded"]
]
)
),
token = token_response[token]
in
token,
// Obtenha o token
token = GetToken(),
// Continue com a lógica de obtenção de arquivos
fn = "/get_file_content/",
root = "https://flounder-amusing-moderately.ngrok-free.app",
root_url = "https://flounder-amusing-moderately.ngrok-free.app/get_files",
root_source = Json.Document(
Web.Contents(
root_url,
[Query=[#"token"=token]]
)
),
filesTable = Table.FromList(root_source, Splitter.SplitByNothing()),
#"Column Expanded" = Table.ExpandRecordColumn(filesTable, "Column1", {"id", "name"}, {"fileId", "Nome do Arquivo"}),
// Filtrar a tabela para encontrar o fileId desejado
file = Table.SelectRows(#"Column Expanded", each Text.Contains([Nome do Arquivo], "EPTNV001 - VCAD_Project Base2")),
// Utilizar Expression.Evaluate com token na URL
file_source = Expression.Evaluate(
Text.FromBinary(
Web.Contents(
root & fn & file{0}[fileId] & "?token=" & token
)
),
#shared
)
in
file_source
It looks like you're trying to connect to a data source that uses OAuth2 authentication. Regardless of the dynamic data source error, if you're trying to connect to a data source that uses OAuth2 authentication you will need to write a custom connector: https://blog.crossjoin.co.uk/2021/08/29/connecting-to-rest-apis-with-oauth2-authentication-in-power-...
Thanks Chris. But could you help me with the M code? I think I'll be able to change the authentication method, so I'd like to try to solve the problem with the code I sent. Could you help?
Hi @gscruzz
The statement boxed in blue will make it recognized as a dynamic data source. Do not use & to combine the root URL and the dynamic part. Instead, use RelativePath and Query parameters.
You mentioned Chris Webb's blog, I usually refer to his following blogs:
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hello friend, thank you very much for your help. I'm not an expert in M language, but I've read all the documentation you've indicated and I've tried some alternatives, but still without success.
I created a new PBIX file and created a null query and after making the modifications and clicking on "Data source settings", I get the message "Some data sources cannot be listed due to manually created queries".
Even so, I published it to the Power BI Service and only confirmed that it is still being considered as a dynamic source, with the error: "This dataset includes a dynamic data source. As dynamic data sources are not updated in the Power BI service, this dataset will not be updated. Find out more: https://aka.ms/dynamic-data-sources."
See below for the changes made:
// Utilizar RelativePath e Query na chamada Web.Contents
file_source = Expression.Evaluate(
Text.FromBinary(
Web.Contents(
root,
[
RelativePath = "/get_file_content/" & fileId,
Query = [token = token]
]
)
),
#shared
)
in
file_source
Once again, I thank you for your goodwill and I would respectfully like to ask for more objective help, as I did not develop this code, I do not have access to the person who developed it and I do not believe that they have sufficient skill to get around the problem. In fact, I've already made "N" attempts, without success, and I've shared above the solution that I believe is most in line with the concepts in the documentation.
In case you need it, I've shared the .PBIX file at the link below:
https://drive.google.com/drive/folders/1-OVIJNqTS9BHDs5mfHp6wLgQwzC6sTaK?usp=sharing
Please refer to the documentation. Use RelativePath and Query parameters.
Web.Contents - PowerQuery M | Microsoft Learn
And change your password...
Thanks, buddy. As I recently informed colleague "v-jingzhan-msft", I have already tried these solutions, but the data source is still being considered as dynamic.
Also, thank you for your attention regarding the user and password, but they are test users, without any associated risk.
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
| User | Count |
|---|---|
| 20 | |
| 9 | |
| 8 | |
| 8 | |
| 7 |