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
pfbrp
Frequent Visitor

Table.SelectRows on Sql.Database

The Soruce is an Sql.Database() returning a table of tables accessible through the [ Data ] column.

Some of those tables return data, but some are either empty or denying access.

I want to have a preview of the rows of the Soruce only where tables return data.

In order to achieve it, I do a simple selection:

pfbrp_0-1739961070906.png

try [ Data ]{ 0 } returns Expression.Error for empty returns and Datasource.Error for access denials.

Entire evaluation look simple, yet the PQ gets stuck loading everlasting thousands of rows.

Any ideas?

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @pfbrp, check this:

 

Before

dufoq3_0-1739983254396.png

 

After

dufoq3_1-1739983265325.png

let
    Source = #table({"Data"}, {{null}, {#table(null, {})}, {error "Just test ERROR"}, {#table(null, {{1,2,3}})}, {"abc"}, {100} } ),
    FlteredTables = Table.SelectRows(Source, each (try [Data] otherwise false) is table)
in
    FlteredTables

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @pfbrp,

Thanks for reaching out to the Microsoft fabric community forum.

 

It looks like you are trying to filter out tables that are empty or inaccessible. As @dufoq3 and @Akash_Varuna both gave responses of their own for your query, can you please confirm if you were able to solve your issue with the help of their responses. If yes, then please mark the helpful response as solution.

 

I would also take a moment to thank @dufoq3 and @Akash_Varuna, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

dufoq3
Super User
Super User

Hi @pfbrp, check this:

 

Before

dufoq3_0-1739983254396.png

 

After

dufoq3_1-1739983265325.png

let
    Source = #table({"Data"}, {{null}, {#table(null, {})}, {error "Just test ERROR"}, {#table(null, {{1,2,3}})}, {"abc"}, {100} } ),
    FlteredTables = Table.SelectRows(Source, each (try [Data] otherwise false) is table)
in
    FlteredTables

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Akash_Varuna
Super User
Super User

Hi @pfbrp  you could try simplifying the query and try this please as your query is evaluating the whole table on try....otherwise 
Table.SelectRows(
Source,
each
try Value.Is([Data]{0}, type table) otherwise false
)
If this post helped please do give a kudos and accept this as a solution 
Thanks In Advance

With small correction (testing for record instead of table):

pfbrp_0-1739963163635.png

I state that the effect is the same.

Did you mean that a whole table is evaluated at each Table.SelectRows() iteration? Why would it be if I'm checking on the first row only?

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.