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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Raul
Post Patron
Post Patron

Filter table names in a connection to a SQL Server database

Hello everyone.

I have a SQL Server database that contains more than 20,000 tables. I need to connect from Power BI Desktop to that database but I want to be able to filter the selection of the necessary tables for those starting with a certain prefix, for example, those starting with CUST *.
How can I specify this initial filter so that I can subsequently select the tables I need without having to load all the tables of the database before in the Navigator screen?

Thanks a lot!!!

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Raul,

 

Please refer to below steps to filter the tables which stored in database.


Steps:

1. Connect to a database.

large.png

 

 

2. Add a filter on 'Name' column and modify the filter formula to use 'Text.StartsWith' function.(For your scenario, you should use "CUST " as keyword to filter.)

4.PNG

 

Full query:

let
    Source = Sql.Databases("xxxxx"),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name],"D"))
in
    #"Filtered Rows"

 

BTW, please not connect too many table at one time. Large amount of tables may affect the performance and system resources.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Raul,

 

Please refer to below steps to filter the tables which stored in database.


Steps:

1. Connect to a database.

large.png

 

 

2. Add a filter on 'Name' column and modify the filter formula to use 'Text.StartsWith' function.(For your scenario, you should use "CUST " as keyword to filter.)

4.PNG

 

Full query:

let
    Source = Sql.Databases("xxxxx"),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name],"D"))
in
    #"Filtered Rows"

 

BTW, please not connect too many table at one time. Large amount of tables may affect the performance and system resources.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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