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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
dmb6996
Frequent Visitor

Row count issue

Hi,

 

When I count the rows of my query I have 30K rows, if I try to load all rows from a calculated column within that query it counts millions of rows.

 

What is causing this? How can I make sure that its counting 30K rows in the calculated column as well? The calculated column is checking whether a key in the current query appears in 1 other query.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dmb6996 ,

 

When you count the number of rows in a query in Power BI, you are actually looking at the number of rows in the query's result set, which is the number of rows in the table after you filtered, aggregated, or otherwise manipulated it. This value is a count of the number of rows in the table after your filtering and manipulation.
However, when you try to load all the rows from the calculated column in that query, there is a calculation mechanism involved for the calculated column. Calculated columns are calculated row-by-row as the data model is loaded or as the query is run, rather than simply counting the number of rows in the result set. This means that the way calculated columns are calculated can result in more rows being created or counted, leading to the millions of rows you observe.
This typically occurs when the calculated column contains references to other tables or queries, especially when one-to-many relationships are involved.

 

In my test, there was a model consisting of a Sales table and an Employees table. The original row record data was only three, but the calculated column created resulted in five, due to the one-to-many relationship between the tables.

IsEmployeeValid = 
IF (
    COUNTROWS (
        FILTER (
            RELATEDTABLE('Employees'),
            'Employees'[EmployeeID] = 'Sales'[EmployeeID]
        )
    ) > 0,
    "Valid",
    "Invalid"
)

vkongfanfmsft_2-1704445825106.png

 

vkongfanfmsft_1-1704445781392.png

 

If the problem persists, please provide the DAX expression used in the calculated column and the relationship between the data models involved.

 

Best Regards,
Adamk Kong

 

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

1 REPLY 1
Anonymous
Not applicable

Hi @dmb6996 ,

 

When you count the number of rows in a query in Power BI, you are actually looking at the number of rows in the query's result set, which is the number of rows in the table after you filtered, aggregated, or otherwise manipulated it. This value is a count of the number of rows in the table after your filtering and manipulation.
However, when you try to load all the rows from the calculated column in that query, there is a calculation mechanism involved for the calculated column. Calculated columns are calculated row-by-row as the data model is loaded or as the query is run, rather than simply counting the number of rows in the result set. This means that the way calculated columns are calculated can result in more rows being created or counted, leading to the millions of rows you observe.
This typically occurs when the calculated column contains references to other tables or queries, especially when one-to-many relationships are involved.

 

In my test, there was a model consisting of a Sales table and an Employees table. The original row record data was only three, but the calculated column created resulted in five, due to the one-to-many relationship between the tables.

IsEmployeeValid = 
IF (
    COUNTROWS (
        FILTER (
            RELATEDTABLE('Employees'),
            'Employees'[EmployeeID] = 'Sales'[EmployeeID]
        )
    ) > 0,
    "Valid",
    "Invalid"
)

vkongfanfmsft_2-1704445825106.png

 

vkongfanfmsft_1-1704445781392.png

 

If the problem persists, please provide the DAX expression used in the calculated column and the relationship between the data models involved.

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.