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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
i36
Regular Visitor

solution:Connect merge multiple database with same table in Power BI,powerquery 批量连接合并多个表结构相同数据库

this solution is my experience.

the English translation maybe not very well

 

0.汇总服务器地址和数据库名称为excel文件,文件名为

input servers as url , databases as database  as excel file named

 

database.xlsx

 

 xlsxxlsx

 

导入到powerquery编辑器中

Import into the powerquery editor

 

00

  1. 正常连接其中一个数据库,按提示输入服务器地址、数据库、相应的账户及密码。

Connect to one of the databases ,enter the server , database, correct account & password normally.

 

11

  • 2.在步骤1基础上创建函数

Create the function below based on step 1

 

fnsql

 

2.12.1

 

2.22.2

 

2.32.3

3.进入高级编辑器,将源=()()修改为

Go to the Advanced Editor and edit() to below where “source =()”.

 

url as text, database as text

填写过的服务器修改为

Modify the server that was filled  to

url

数据库修改为

Modify the database that was filled  to

database

3.13.1

 

3.23.2

 

4.复制步骤0的查询并粘贴

Copy the query from step 0 and paste it

 

4.14.1

 

4.24.25.在database(2)中添加自定义列

Add a custom column below in database(2).

 

fnsql([url],[database])

 

55

6.展开自定义列所需字段即可。

 

Expand the fields required for the custom column.

66

如果连接服务器时提示权限问题,请根据提示选择选项并输入数据库账户及密码

If you are prompted with permission questions when you connect to the server, follow the prompts to select options and enter the database account and password

1 REPLY 1
Anonymous
Not applicable

Hi @i36 ,

Thank you for your sharing. Please mark the reply to close the case and help more people find the answer.

 

Best Regards

Community Support Team _ Polly

 

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

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.