Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Power BI Complete Reference

You're reading from   Microsoft Power BI Complete Reference Bring your data to life with the powerful features of Microsoft Power BI

Arrow left icon
Product type Course
Published in Dec 2018
Publisher Packt
ISBN-13 9781789950045
Length 794 pages
Edition 1st Edition
Arrow right icon
Authors (5):
Arrow left icon
Brett Powell Brett Powell
Author Profile Icon Brett Powell
Brett Powell
Mitchell Pearson Mitchell Pearson
Author Profile Icon Mitchell Pearson
Mitchell Pearson
Brian Knight Brian Knight
Author Profile Icon Brian Knight
Brian Knight
Devin Knight Devin Knight
Author Profile Icon Devin Knight
Devin Knight
Manuel Quintana Manuel Quintana
Author Profile Icon Manuel Quintana
Manuel Quintana
+1 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (25) Chapters Close

Title Page
About Packt
Contributors
Preface
1. Getting Started with Importing Data Options FREE CHAPTER 2. Data Transformation Strategies 3. Building the Data Model 4. Leveraging DAX 5. Visualizing Data 6. Using a Cloud Deployment with the Power BI Service 7. Planning Power BI Projects 8. Connecting to Sources and Transforming Data with M 9. Designing Import and DirectQuery Data Models 10. Developing DAX Measures and Security Roles 11. Creating and Formatting Power BI Reports 12. Applying Custom Visuals, Animation, and Analytics 13. Designing Power BI Dashboards and Architectures 14. Managing Application Workspaces and Content 15. Managing the On-Premises Data Gateway 16. Deploying the Power BI Report Server 17. Creating Power BI Apps and Content Distribution 18. Administering Power BI for an Organization 19. Scaling with Premium and Analysis Services 1. Other Books You May Enjoy Index

DirectQuery


Many of you have likely been trying to envision how you may implement these data imports in your environment. You may ask yourself questions such as the following:

  • If data imported into Power BI uses an in-memory technology, did my company provide me a machine that has enough memory to handle this? 
  • Am I really going to import my source table with tens of billions of rows into memory?
  • How do I handle a requirement of displaying results in real time from the source?

These are all excellent questions that would have many negative answers if the only way to connect to your data was by importing your source into Power BI. Fortunately, there is another way. Using DirectQuery, Power BI allows you to connect directly to a data source so that no data is imported or copied into the Power BI Desktop.

Why is this a good thing? Consider the questions that were asked at the beginning of this section. Since no data is imported to the Power BI Desktop, that means it is less important how powerful your personal laptop is because all query results are now processed on the source server instead of your laptop. It also means that there is no need to refresh the results in Power BI because any reports you design are always pointing to a live version of the data source. That's a huge benefit!

Enabling this feature can be done by simply selecting DirectQuery during the configuration of a data source. The following screenshot shows a connection to an SQL Server database with the DirectQuery option selected:

Earlier in this chapter, the Data Gateway application was mentioned as a requirement to schedule data refreshes for sources that used the import option. This same application is also needed with DirectQuery if your data is an on-premises source. Even though there is no scheduled data refresh, the Data Gateway is still required to push on-premises data into the cloud. Again, this will be discussed in more depth inChapter 6, Using a Cloud Deployment with the Power BI Service.

Limitations

So, if DirectQuery is so great, why not choose it every time? Well, with every great feature you will also find limitations. The first glaring limitation is that not all data sources support DirectQuery. As of the time this book was written, the following data sources support DirectQuery in Power BI:

  • Amazon Redshift
  • Azure HDInsight Spark 
  • Azure SQL Database
  • Azure SQL Data Warehouse
  • Google BigQuery 
  • IBM Netezza 
  • Impala (Version 2.x)
  • Oracle Database (Version 12 and above)
  • SAP Business Warehouse Application Server
  • SAP Business Warehouse Message Server
  • SAP HANA
  • Snowflake
  • Spark  (Version 0.9 and above)
  • SQL Server
  • Teradata Database
  • Vertica 

Depending on the data source you choose, there is a chance of slower query performance when using DirectQuery compared to the default data import option. Keep in mind that when the import option is selected it leverages a highly sophisticated in-memory storage engine. When selecting DirectQuery, performance will depend on the source type you have chosen from the list above.

Another limitation worth noting is that not all Power BI features are supported when you choose DirectQuery. For example, depending on the selected source, some the Power Query Editor features are disabled and could result in the following message: This step results in a query that is not supported in DirectQuery mode. Another example is that some DAX functions are unavailable when using DirectQuery. For instance, several Time Intelligence functions such as TotalYTD would generate the following type error when using DirectQuery:

The reason for this limitation is because DirectQuery automatically attempts to convert DAX functions such as this one to a query in the data source's native language. So, if the source of this solution was SQL Server, then Power BI would attempt to convert this DAX function into a comparable T-SQL script. Once Power BI realizes the DAX function used is not compatible with the source, the error is generated.

Note

You can turn on functions that DirectQuery blocks by going to File | Optionsandsettings | Options | DirectQuery | Allow restricted measures in DirectQuery Mode. When this option is selected, any DAX expressions that are valid for a measure can be used. However, you should know that selecting this can result in very slow query performance when these blocked functions are used.

 

You have been reading a chapter from
Microsoft Power BI Complete Reference
Published in: Dec 2018
Publisher: Packt
ISBN-13: 9781789950045
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime