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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Markzolotoy
Impactful Individual
Impactful Individual

Create a query to select data from a table

How do I write a query to select data from a SQL table? I mean an SQL statement to get specific data from te table.

 

Thanks

5 REPLIES 5
Greg_Deckler
Super User
Super User

When you connect to SQL Server, expand the "Advanced options" as show in the screen shot below and then just paste in your SQL code.

SQL Server Database.png


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

That is when I import data. But about pulling data at real time? 

Hi Markzolotoy,

Do you connect to the table from on-premises SQL Server database in Power BI Desktop and want to pull data at real time? If that is the case, there is no such feature in Power BI Desktop. However we can manually change query to select different data using Advanced Editor of Query Editor, for more details about Advanced Editor, please review the this article: https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-query-overview/ .

Moreover, we can utilize the Schedule Refresh feature to refresh dataset created from Power BI Desktop files imported from a local drive where Get Data/Query Editor is used to connect to and load data from on-premises SQL Server database. For more details, please review the following articles.

https://powerbi.microsoft.com/en-us/documentation/powerbi-refresh-desktop-file-local-drive/
https://powerbi.microsoft.com/en-us/documentation/powerbi-refresh-data/#understanding-data-refresh

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

so if i wanted to select data from a view in a DB2 database, i cannot create a datasource of that nature is that correct?  I have successfully created the data source for said DB2 connection and am able to pull all the data from the view but i would like to limit it further with SQL.  Thanks

Should be essentially the same process. See the Advanced options here for DirectQuery from Azure SQL Database:

 

https://powerbi.microsoft.com/en-us/documentation/powerbi-azure-sql-database-with-direct-connect/

 

Advanced options provides a Custom filters section, and supplies an example of a SELECT statement.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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