Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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, @FabioRCampos
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, @FabioRCampos
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.
User | Count |
---|---|
23 | |
20 | |
10 | |
9 | |
7 |
User | Count |
---|---|
46 | |
29 | |
19 | |
18 | |
15 |