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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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!
Solved! Go to Solution.
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
Then choose the table you want and invoke
If the you delete/add a column in the origin table, this value will automatically change after refresh.
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.
Hi,
An extension to this question - is it possible to count how many columns are of type "numeric", how many are of type "text"?
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.
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
Then choose the table you want and invoke
If the you delete/add a column in the origin table, this value will automatically change after refresh.
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.
Thank you v-lid-msft, that was very helpful!
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.