Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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

  • Icey's avatar
    Icey
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    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.