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

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

Reply
Anonymous
Not applicable

Number of Rows of All Tables in Power Query

how can i get the number of rows in all tables using Power Query M.

 

For Exemple:

 

TableNameRows
Table A50
Table B45
Table C32

 

I tried this, but it doesn't work:

 

 

 

 

let
        Fonte = #sections[Section1]
    
    ,   ToTable = Record.ToTable(Fonte)
    
    ,   ExcludeDQ = Table.SelectRows(ToTable, each (
                                                    [Name] <> "Qualidade"
                                                    )
                                            )

    ,   ListofTables = ExcludeDQ[Name]

    ,   AddColumn = Table.AddColumn(
                                        ExcludeDQ
                                        ,"Quantidade de Linhas"
                                        ,each ListofTables Table.RowCount(ListofTables)
    )
    )
  
in
        ExcludeDQ

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

Using your approach - what you need to pass to RowCount is [Value] rather than [Name]:

let
    Source = #sections[Section1],
    #"Converted to Table" = Record.ToTable(Source),
    #"Added Custom" = Table.AddColumn(#"Converted to Table", "RowCount", each Table.RowCount([Value]))
in
    #"Added Custom"

 

However, this won't take you anywhere past the Editor. It does not work correctly in the Visuals Editor and not going to refresh - actually will halt on error - online. So, if the purpose of this is purely design-time statistics - Ok, if you want to use it anywhere past the PQ Editor - use the approach suggested by Jimmy. Do not forget that you need not Table Names, it is actually ReferencetoTable (i.e. Table vs. "Table" in the list).

 

Kind regards,

JB

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

 

Using your approach - what you need to pass to RowCount is [Value] rather than [Name]:

let
    Source = #sections[Section1],
    #"Converted to Table" = Record.ToTable(Source),
    #"Added Custom" = Table.AddColumn(#"Converted to Table", "RowCount", each Table.RowCount([Value]))
in
    #"Added Custom"

 

However, this won't take you anywhere past the Editor. It does not work correctly in the Visuals Editor and not going to refresh - actually will halt on error - online. So, if the purpose of this is purely design-time statistics - Ok, if you want to use it anywhere past the PQ Editor - use the approach suggested by Jimmy. Do not forget that you need not Table Names, it is actually ReferencetoTable (i.e. Table vs. "Table" in the list).

 

Kind regards,

JB

Anonymous
Not applicable

This works! thank you

Jimmy801
Community Champion
Community Champion

Hello

List.Count(Table.ColumnNames(yourtable)) should do the trick. However you need a table or a list where all your tables are listed.

Jimmy

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Kudoed Authors