Table.ColumnCount

 

This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Returns the number of columns in a table.

Table.ColumnCount(table as table) as number  

ArgumentDescription
tableThe Table to check.
let  
  
    emptyTable = Table.FromRows({}),  
  
    tableValue = Table.FromRows({{1,"Bob", "123-4567"}, {2,"Jim", "987-6543"}}, {"ProductID", "ProductName", "UnitPrice"})  
  
in  
  
[  
  
    IsEmptyTest1    = Table.IsEmpty(emptyTable),  
  
    IsEmptyTest2 = Table.IsEmpty(tableValue),  
  
    RowCount = Table.RowCount(tableValue),  
  
    ColumnCount = Table.ColumnCount(tableValue)  
  
]  
  
equals  

IsEmptyTest1true
IsEmptyTest2false
RowCount2
ColumnCount3
Show: