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
Anonymous
Not applicable

How to reduce the data while using "Get Data" through SQL Server

Hello,

I have a SQL Server database that has 14M rows. I would like to know if I can set criteria while uploading the data in Power BI that would only bring in data from Year 2017 to 2020.

I do see an option to write SQL queries in advance options. The column that contains year is called Fiscal_Year.

 

The problem is I cannot directly connect to the database. I have to choose the server first and then after completing the authentication I can choose the database.

 

SQL Query.PNG

 

 

 

2 ACCEPTED SOLUTIONS
edhans
Super User
Super User

Do not use that Advanced Query setting. 

 

Just connect to the data. Then the first thing you do is filter your data as you want via the Fiscal Year field. You will notice when you do that, if you right-click the Filtered Rows step and select View Native Query, you will see Power Query is generating a SQL statement for you. You will eventually "break" query folding with some later step most likely, but that first filter will keep you with your 2017-2020 data. 

edhans_0-1594343541018.png

Also note that when working in Power Query, it never brings in all of the rows anyway until you do a full refresh. It only brings in 1,000 or so when you are working. It only does the full 14M rows when you load it to the data model. Or however many are in the 2017-2020 range if you keep that filter in place. In that case, SQL Server only returns the 3M rows (I made that number up) in the 2017-2020 range, not the full 14M in the entire data set.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

As mentioned by @edhans ,you can directly run native database queries against the database using Power Query in your scenario. For more details about importing Data from Database using Native Database Query (Power Query), you can refer to this article.

 

also you can use query parameter to filter your table. More details about query parameter, please refer to: https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/.

 

Community Support Team _ Dina Ye
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

2 REPLIES 2
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

As mentioned by @edhans ,you can directly run native database queries against the database using Power Query in your scenario. For more details about importing Data from Database using Native Database Query (Power Query), you can refer to this article.

 

also you can use query parameter to filter your table. More details about query parameter, please refer to: https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
edhans
Super User
Super User

Do not use that Advanced Query setting. 

 

Just connect to the data. Then the first thing you do is filter your data as you want via the Fiscal Year field. You will notice when you do that, if you right-click the Filtered Rows step and select View Native Query, you will see Power Query is generating a SQL statement for you. You will eventually "break" query folding with some later step most likely, but that first filter will keep you with your 2017-2020 data. 

edhans_0-1594343541018.png

Also note that when working in Power Query, it never brings in all of the rows anyway until you do a full refresh. It only brings in 1,000 or so when you are working. It only does the full 14M rows when you load it to the data model. Or however many are in the 2017-2020 range if you keep that filter in place. In that case, SQL Server only returns the 3M rows (I made that number up) in the 2017-2020 range, not the full 14M in the entire data set.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.