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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Count the total amount of columns in a table with a measure?

Hey guys,

 

Is it possible to create a measure that counts the amount of columns in a table?

If yes, how? I couldn't find a way by googling.

 

Thanks!

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

Hi @Anonymous ,

 

We can archieve this easily in Power Query Editor using the Table.ColumnCount function:

 

Create a blank query using the following formula:

 

let
    Source = Table.ColumnCount
in
    Source

4.PNG

Then choose the table you want and invoke

 

5.PNG6.PNG

 

If the you delete/add a column in the origin table, this value will automatically change after refresh.

 

7.PNG

 


BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi, 

An extension to this question - is it possible to count how many columns are of type "numeric", how many are of type "text"?

Anonymous
Not applicable

I found that I can use the Table.Schema function. Within that, there is a "Kind" field that identifies the column type as either "number" or "text.

v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can archieve this easily in Power Query Editor using the Table.ColumnCount function:

 

Create a blank query using the following formula:

 

let
    Source = Table.ColumnCount
in
    Source

4.PNG

Then choose the table you want and invoke

 

5.PNG6.PNG

 

If the you delete/add a column in the origin table, this value will automatically change after refresh.

 

7.PNG

 


BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you v-lid-msft, that was very helpful!

mussaenda
Super User
Super User

I think its possible in power query.

If you are open for power query, you can transpose the table then count the rows then transpose again to retain your orig format.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors