Forum Discussion
Records from sql server VIEW are missed in power query
I want to get all the records in SQL server VIEW inside Power BI Power Query QUERY
I have data about employees assigned to new projects, it stored in a SQL Server VIEW, and it contains 13,474 records, The VIEW is based on master and detail tables. One of the columns in the VIEW is named “project_effective_date”, I am using it inside power query to validate the pulled records, and it contains old and new project effective dates for the years {2015, 2016, 2020, 2021, 2022, 2023}.
I have connected to this VIEW from Power Query using direct mode in one power bi file and import mode in onther one.
The issue that I experiencing, is from the 13,470 records only 7,148 records have been pulled inside the power query in both power bi files (direct mode & import mode).
- I have validated the number of records in power query by using "count values" option in statistics option in power query on a primary key column "transaction_number" which has no null values.
- Also, I have noticed that all records belong to project_effective_date = 2023, and some records from other project_effective_dates are not showing up.
- Also, I have added a "clustered bar chart" visual to display the number of employees by project in 2023, but the visual is display nothing.
- Also, I have executed a the below query against the VIEW to count the number of employees by year and this is the result
SELECT COUNT([EffectiveDate])AS [number_of_employyes], datepart(yyyy, [EffectiveDate]) as [year]
FROM [dbo].[BIView_ChangeOverForms]
WHERE datepart(yyyy, [EffectiveDate]) IS NOT NULL
GROUP BY datepart(yyyy, [EffectiveDate])
ORDER BY datepart(yyyy, [EffectiveDate]) ASC
| number_of_employyes | year |
|--------------------------|-------|
| 30 | 2015 |
| 17 | 2016 |
| 2010 | 2020 |
| 4725 | 2021 |
| 5235 | 2022 |
| 1453 | 2023 |
the total number of employees in the VIEW = 13,470
- Also, I have Grouped the records in power query to count the number of employees by year and this is the result
| number_of employees | Year |
|--------------------------|-------|
| 30 | 2015 |
| 17 | 2016 |
| 1995 | 2020 |
| 4737 | 2021 |
| 368 | 2022 |
the total number of employees in the power query = 7,147
I have compared the total umber of emplyees from VIEW & POWER QUERY
missed records: 13,470 - 7,147 = 6.319
Note: there's no filter applied on any column in power query. And I have updated Power BI to the latest version
2 Replies
- AnonymousNot applicable
Not to insult you, but do you have a data table in the mix that might be filtered and related to your direct query table?
--Nate
- GambosNew Member
I have enhanced the question, please check it again.
thanks for your reply