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

COUNTROWS raising value to power of 2 (squaring the result)!

I have a query in Power BI that returns the top 17 rows from a table.

 

I use COUNTROWS(table) to return the number of rows in the table and the result is 289!  How can this be??  No filter anywhere on the report.

 

Here is the DAX formula I am using.  This happens anywhere I try to apply the COUNTROWS function in my report.

 

Column = COUNTROWS(Query1)
 
Query1:
SELECT TOP 17 Name FROM dbo.Customer
 
I'm losing my mind over this.
1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @MikeyLikesPwrBI 

 

I assume you stucture is like this:

 

-You have table named Query1. 

-Query1 is a table with 1 column and 17 rows.

-You add calculated column called Column with this code

Column = COUNTROWS(Query1)

 

For each row of Query1, the value of Column will be 17.

 

If you now drag Column into any kind of visual, it will sum up all rows of Column, giving you 17*17.

This can solved by creating a measure like this:

numberOfRows = countrows(Query1)

instead of doing it like a calculated column.

If I am wrong in my assumptions, it would be helpfull if you recreate your issue in a sample report and share that report here

Cheers,
Sturla

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.