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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
David_Service
Frequent Visitor

Different Number of Rows in SQLServer and PowerBi Query

Hi Everyone,

 

I have encountered an odd error where a query in SQL Server and the same query in PBI are returning different results. For example, this query in SQLServer :

 

SELECT Count(*) FROM Contract WHERE Contract.IssueNumber = 1 AND Contract.ContractCreateDate > '01/06/2020'

 

Returns 251 rows (this is what is expected) but importing the contract table and filtering by IssueNumber and ContractCreateDate is giving me only 214 rows. This is a very simple query so I'm kind of lost as to where I went wrong. Can anyone give me any pointers on this? 

2 REPLIES 2
Icey
Community Support
Community Support

Hi @David_Service ,

 

Hope this post could help you: Rows missing in imported data from SQL-Connection (Power BI desktop).

 



I managed to solve the issue and it indeed had to do with the column formating. The data format for the matching columns in the query merge were data type 'Any' for both columns.

 

For some reason most rows matched except a few rows apparently having a different format. I changed the format of the matching ID columns to 'Text' which solved the issue.




 

Best Regards,

Icey

 

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

aj1973
Community Champion
Community Champion

Hi @David_Service 

Check if there is a limit of data imported from SQL server into Power BI. Sometimes there is a limit of 2000 Rows in SQL server therefore the countrows in power bi will be different as it could be missing some rows.

 

Your issue might be similar to this one

https://community.powerbi.com/t5/Desktop/Power-BI-missing-some-data-from-SF-report/m-p/1187374#M5331...

 

Regards  

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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