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 recently published a dashboard, and among the data sources, there was a custom query as shown below:
let
// Defina a lista de moedas que deseja consultar
ListaMoedas = {"USD-BRL", "PEN-BRL","ARS-BRL","COP-BRL","CLP-BRL","MXN-BRL","EUR-BRL","PEN-USD","ARS-USD","COP-USD","CLP-USD","MXN-USD","BRL-USD","EUR-USD"}, // Adicione mais moedas conforme necessário
// Calcule as datas dinâmicas
DataHoje = Date.From(DateTime.LocalNow()),
DataInicio = Date.AddDays(DataHoje, -30),
DataHojeTexto = Date.ToText(DataHoje, "yyyyMMdd"),
DataInicioTexto = Date.ToText(DataInicio, "yyyyMMdd"),
// Função para obter dados da API para uma moeda específica
GetDadosMoeda = (Moeda as text) =>
let
URL = "https://economia.awesomeapi.com.br/json/daily/" & Moeda & "/?start_date=" & DataInicioTexto & "&end_date=" & DataHojeTexto,
Fonte = Json.Document(Web.Contents(URL)),
Tabela = Table.FromList(Fonte, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
ExpandeColunas = Table.ExpandRecordColumn(Tabela, "Column1", {"code", "codein", "name", "high", "low", "varBid", "pctChange", "bid", "ask", "timestamp", "create_date"}, {"Code", "Codein", "Name", "High", "Low", "VarBid", "PctChange", "Bid", "Ask", "Timestamp", "CreateDate"}),
AdicionaMoeda = Table.AddColumn(ExpandeColunas, "Moeda", each Moeda)
in
AdicionaMoeda,
// Combine os dados de todas as moedas
DadosCombinados = Table.Combine(List.Transform(ListaMoedas, each GetDadosMoeda(_))),
#"Tipo Alterado com Localidade" = Table.TransformColumnTypes(DadosCombinados, {{"CreateDate", type datetime}}, "en-US"),
#"Tipo Alterado" = Table.TransformColumnTypes(#"Tipo Alterado com Localidade",{{"CreateDate", type date}})
in
#"Tipo Alterado"
When I tried to schedule the updates (Power BI Services), it displayed the following error:
Within Power BI, in the data source settings (Pbix file), I also have this information:
How do I resolve this?
Solved! Go to Solution.
Implement the correct Power Query code, using RelativePath and Query.
Hi, @Anonymous
Make sure that the Power BI service has the credentials required to access the external APIs. This typically involves configuring the data gateway and ensuring that the Power BI service is using the correct credentials and has the necessary permissions. For more information about setting up data source credentials, see:
Configure scheduled refresh - Power BI | Microsoft Learn
If the API is considered an on-premises data gateway from a Power BI service perspective, you may need an on-premises data gateway to facilitate connectivity. Make sure that the gateway is properly installed, configured, and linked to the Power BI service. For detailed steps to set up an on-premises data gateway, visit On-premises data gateway:
Configure scheduled refresh - Power BI | Microsoft Learn
Power BI requires you to configure a privacy level for your data source to control how your data is combined. Incorrect privacy level settings may prevent the refresh operation. You can check the following link:
Solved: Some data sources may not be listed because of han... - Microsoft Fabric Community
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Make sure that the Power BI service has the credentials required to access the external APIs. This typically involves configuring the data gateway and ensuring that the Power BI service is using the correct credentials and has the necessary permissions. For more information about setting up data source credentials, see:
Configure scheduled refresh - Power BI | Microsoft Learn
If the API is considered an on-premises data gateway from a Power BI service perspective, you may need an on-premises data gateway to facilitate connectivity. Make sure that the gateway is properly installed, configured, and linked to the Power BI service. For detailed steps to set up an on-premises data gateway, visit On-premises data gateway:
Configure scheduled refresh - Power BI | Microsoft Learn
Power BI requires you to configure a privacy level for your data source to control how your data is combined. Incorrect privacy level settings may prevent the refresh operation. You can check the following link:
Solved: Some data sources may not be listed because of han... - Microsoft Fabric Community
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Implement the correct Power Query code, using RelativePath and Query.
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 |
---|---|
49 | |
32 | |
27 | |
27 | |
26 |
User | Count |
---|---|
61 | |
56 | |
34 | |
29 | |
28 |