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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
GabrielTec
New Member

Erro Atualização de Dados (Dinâmicos) - Power BI Service

Boa noite, pessoal!

 

Criei um dashboard que coleta informações de API de diversas contas de uma plataforma e estou tentando automatizar esse processo.

Para isso, eu criei uma tabela com o nome da conta e o token de acesso.

 

 

Source = Table.FromRecords({
        [Conta = "Conta1", Token = "xxx-xxx-xxx1"],
        [Conta = "Conta2", Token = "xxx-xxx-xxx2"],
        [Conta = "Conta3", Token = "xxx-xxx-xxx3"]
    })

 

 

 

Depois, desenvolvi duas funções: uma para obter a quantidade de páginas e outra para realizar a chamada em si, trazendo todos os dados de todas as contas e páginas.

Primeira função: 

 

 

(token as text) =>
let
    Fonte = Json.Document(
        Web.Contents(
            "https://api.xxx/v1/contacts/?page=1",
            [Query =[api_token = token]]
        )
    )
in
    Fonte

 

 

 

Após usar essa função, consigo a informação sobre a quantidade de páginas e uso o List.Numbers para criar uma lista que vai de 1 até o total de páginas de cada conta.

 

A única forma que encontrei para fazer funcionar no Power BI Desktop foi criar uma coluna personalizada com a URL da API. Então, a URL fica mais ou menos assim: https://api.xxx/v1/contacts/?page=2 , com diversas linhas, cada uma representando uma página diferente de cada conta.

 

E logo utilizo a Segunda função:

 

 

(url as text, token as text) =>
let
    Fonte = Json.Document(
                Web.Contents(
                url,
                [Query = [api_token = token]]
                )
            ) 
in
    Fonte

 

 

Como podem ver, funcionou!

GabrielTec_0-1721872514157.png

O Problema:

Quando publico no Power BI Service, aparece o seguinte erro:

GabrielTec_1-1721872599081.png

Já tentei usar o RelativePath para a URL na segunda função, mas não funciona no desktop e então aparece esse erro:

GabrielTec_2-1721872767416.png

 

Tentei de várias formas, mas não consigo encontrar uma solução.

Alguém pode me ajudar com isso?

1 ACCEPTED SOLUTION

Hi , @Anonymous,

First of all, thank you for your help! Unfortunately, it didn't work out...

For some reason, Power Query can read the function that pulls the token column, but the function that pulls the pages column doesn't work at all. I suspect the pages column is dynamic, and Power Query doesn't support that dynamic nature.

As a solution, I had to make separate calls, one for each token (account), and then combine the tables. It's a more time-consuming approach, but it was the only one that worked.

In any case, thank you for your support!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @GabrielTec ,

Have your problem solved, if so, please mark as solution the correct answer.

Best Regards,

Xianda Tang

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

Hi , @Anonymous,

First of all, thank you for your help! Unfortunately, it didn't work out...

For some reason, Power Query can read the function that pulls the token column, but the function that pulls the pages column doesn't work at all. I suspect the pages column is dynamic, and Power Query doesn't support that dynamic nature.

As a solution, I had to make separate calls, one for each token (account), and then combine the tables. It's a more time-consuming approach, but it was the only one that worked.

In any case, thank you for your support!

Anonymous
Not applicable

Hi @GabrielTec ,

It seems that you are facing a common problem when trying to refresh data in Power BI Service.The error you are seeing indicates that the data source does not support refreshing in the service.

Here are some suggestions to solve this problem:

1.Configuring Credentials in Power BI Service:

Make sure that the credentials are configured correctly in the Power BI Service. Go to the dataset settings and check that the API credentials are correct.

2.Using a Data Gateway:

If the API you are accessing is within a private network or requires a gateway, configure a data gateway in Power BI Service.

In most cases, it is not possible to refresh a Power BI semantic model that uses dynamic data sources in the Power BI service. There are a few exceptions where it is possible to refresh dynamic data sources in Power BI Services, for example, when using RelativePath and query options in conjunction with the Web.Contents M function. You can also refresh queries that reference Power Query parameters.

To determine if you can refresh dynamic data sources, open the Data Source Settings dialog box in the Power Query editor and select Data Sources in Current File. In the window that appears, look for the following warning message, as shown in the following figure:

vxiandatmsft_0-1721970732560.png

 

Below is the official link will help you:

Troubleshooting unsupported data source for refresh - Power BI | Microsoft Learn

Data refresh in Power BI - Power BI | Microsoft Learn

Best Regards,

Xianda Tang

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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