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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mariano_raphael
New Member

Multiplas conexões em uma string de conexão

Boa tarde,

estou estudando PowerBI e me apareceu uma dúvida que ainda não sei como resolver.

Digamos que tenha mais de 2 bases de dados iguais em sua estrutura, onde o que muda é a conexão de dados. Por exemplo, empresa A e B cada uma com sua base de dados, porém sistemas absolutamente iguais.

Precisaria que o PowerBI conecta-se e extrai-se os dados dessas empresas em uma única conexão.

Por exemplo... hoje teria uma conexão mais ou menos desta forma em um MYSQL(pode ser qualquer banco)

= MySQL.Database(host, base_dados, [ReturnSingleDatabase=true, Query="SELECT #(......

onde host e base_dados são os parâmetros de conexão(fiz dessa forma para quando sair da base de teste e ir para produção é só mudar os valores destes parâmetros).

Qual seria o caminho ? colocar em um laço? em um for?

Existe algo que posa fazer nesta situação?

Também precisaria achar uma forma de diferenciar quais são as informações da empresa A e B em cada tabela. Acredito que colocar um valor para cada conexão já é o suficiente

Atte;

 

2 REPLIES 2
mariano_raphael
New Member

Hello,

first of all, thank you very much. But this behavior is not what was expected. I explain below.
From the research I've done, I don't think the PBI is able to do the way I expected.
In this form that was passed and in the blog you can create several parameters, however you can use
one parameter at a time. That is, when extracting the information, it informs the connection parameter in the
parameters and performs the extraction. This is useful in development/production environments, recovery of
disasters for example, where you just change the parameter and run the extraction/update.
In my case, I would like a way where the connection parameters are really dynamic.
The idea is to extract two identical tables, but from different data sources.
PowerBI should be able to extract the information from the two tables and consolidate it into a single object.

mariano_raphael_0-1668194145666.png

 

There are ways to consolidate this information like making a copy and changing the connection for example. There are other ways to do this, but similar.
Now think of an environment where you have about 10 tables to extract from each company (thinking small). I will have to keep doing this process every time
a new table is added?

Imagine in an environment where there are about 100 PBI views with the same structure but with only different tables.

Of course, a DataWarehouse would easily resolve this issue, but that's not the case. The idea was to just pass the parameters once (it could even be via the database) and that would be
changed for all PBI views without the need to keep making copies of tables, opening views to change and etc...

I thought maybe I could put a While or something in the data source and the PBI runs until the end. You have no idea if that's possible here,
so I asked for help.

 

v-yiruan-msft
Community Support
Community Support

Hi @mariano_raphael ,

Please review the following blogs and check whether Power Query parameter can achieve your requirement.

Using the Power BI Service Parameters to change connection strings

yingyinr_1-1668136671572.png

Power BI Desktop Query Parameters

yingyinr_2-1668136710136.png

Best Regards

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

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.