DirectLake vs DirectQuery vs Import
Complete the full lesson to earn 25 points
Work through each section, then tap “Mark as Complete” on the last one.
DirectLake vs DirectQuery vs Import: Choosing the Right Data Connection Strategy
When you start building a Power BI report or a data model in Microsoft Fabric, the first and most critical decision you face isn't about which colors to use in your charts or which DAX formulas to write. The most important decision is how your report will talk to your data. This decision defines your report's speed, how often the data updates, and how much data you can handle before the system starts to crawl.
Historically, we had two main choices: Import and DirectQuery. Import was fast but required constant refreshing. DirectQuery was slow but gave us live data. With the introduction of Microsoft Fabric, a third option appeared: DirectLake. This mode attempts to provide the best of both worlds—the speed of Import with the live-data capabilities of DirectQuery. Understanding the nuances between these three is the difference between a tool that users love and a tool that users find frustratingly slow.
In this lesson, we will break down the mechanics of each storage mode, explore the technical trade-offs, and look at real-world scenarios to help you choose the right path for your specific project.
1. Import Mode: The High-Performance Classic
Import mode is the default and most common way to bring data into Power BI. When you use Import mode, Power BI takes a snapshot of your data from the source (like a SQL database, an Excel file, or a web API) and loads it into the Power BI Desktop's internal memory. This memory is managed by the VertiPaq engine, a highly sophisticated columnar storage database.
How Import Mode Works
When you click "Refresh," Power BI connects to your source, pulls every row and column you’ve requested, and compresses that data into a format optimized for analytical queries. Because the data lives entirely within the Power BI service's memory, the performance is incredibly fast. When a user interacts with a slicer or a chart, the engine doesn't have to go back to the original database; it simply looks at its own internal memory.
The VertiPaq engine is famous for its compression ratios. It can often shrink a 10GB database down to 1GB or less by looking for patterns in the data. For example, if you have a "Country" column with millions of rows but only 200 unique values, VertiPaq only stores those 200 values and a map of where they appear, rather than repeating the full text millions of times.
Strengths of Import Mode
- Blazing Speed: Since all calculations happen in-memory, users experience near-instant response times when filtering or drilling down.
- Full DAX Support: You have access to the entire library of Data Analysis Expressions (DAX). Some complex functions don't work well in other modes, but in Import mode, everything is on the table.
- Offline Capability: Since the data is stored within the file, you can work on your report even if you aren't connected to the original data source.
Limitations of Import Mode
- Data Latency: Your data is only as fresh as your last refresh. If you refresh once a day, your report will be up to 24 hours out of date.
- Size Constraints: There are limits to how much data you can import. In a Power BI Pro license, a single dataset cannot exceed 1GB. Even with Premium, while the limits are much higher, you are still limited by the memory capacity of your capacity.
- Refresh Overhead: Large datasets can take a long time to refresh, putting a strain on both the source system and the Power BI service.
Callout: The VertiPaq Engine The VertiPaq engine is the "secret sauce" behind Import mode. It is a columnar database, meaning it stores data by column rather than by row. This is why Power BI is so fast at aggregating data (like summing millions of sales rows) but can be slower if you try to display a table with 50 different columns. Always remove unnecessary columns to help VertiPaq compress your data more effectively.
2. DirectQuery Mode: The Live Connection
DirectQuery takes the opposite approach to Import. Instead of taking a snapshot and moving it into Power BI, DirectQuery leaves the data exactly where it is—in the source database. When a user interacts with a report, Power BI generates a query on the fly (usually in SQL) and sends it to the source database. The database processes the query and sends the results back to Power BI to be displayed.
How DirectQuery Works
Imagine you have a dashboard showing factory sensor data that updates every few seconds. If you used Import mode, you would have to trigger a refresh every few seconds, which isn't practical. With DirectQuery, every time a user opens the report or changes a filter, Power BI asks the SQL database, "What is the current average temperature for Sensor A?" The database answers, and the visual updates.
Strengths of DirectQuery
- Real-Time Data: There is no "refresh" in the traditional sense. The report always shows the most current data available in the source system.
- Massive Datasets: Since the data isn't stored in Power BI, you aren't limited by the 1GB or 10GB memory limits. You can connect to a multi-terabyte data warehouse and only pull the specific numbers needed for a visual.
- Centralized Security: If your database has complex security rules (like Row-Level Security) already set up, DirectQuery can often respect those rules because the query is running directly against that source using the user's credentials.
Limitations of DirectQuery
- Performance Bottlenecks: The report is only as fast as the underlying database. If your SQL Server is busy or poorly indexed, your Power BI report will feel sluggish.
- Limited DAX: Not all DAX functions can be translated into the native language of the source database (like SQL or KQL). If you try to use a complex DAX function that the source doesn't understand, you’ll get an error.
- Network Overhead: Every single interaction generates a new query. If you have 100 users looking at a dashboard with 10 visuals each, that could result in 1,000 queries hitting your database simultaneously.
Note: DirectQuery requires a very strong "Query Folding" setup. Query Folding is the process where Power BI's Power Query engine translates your data transformation steps into a single SQL statement. If Query Folding breaks, Power BI might try to pull millions of rows into its local engine to perform a calculation, which defeats the purpose of DirectQuery and causes massive slowdowns.
3. DirectLake Mode: The Best of Both Worlds
DirectLake is the newest storage mode, exclusive to Microsoft Fabric. It represents a fundamental shift in how we think about data storage. In the past, we had to choose between the speed of Import and the freshness of DirectQuery. DirectLake removes that choice by reading data directly from "OneLake" (the central storage for Fabric) in its native Parquet format, but loading it into memory just like Import mode does.
How DirectLake Works
In Microsoft Fabric, data is stored in the Lakehouse or Warehouse in a format called Delta Parquet. Parquet is a columnar storage format, very similar to how the VertiPaq engine stores data. Because the data is already stored in a way that Power BI likes, the Power BI engine can "map" those files directly into its memory without needing a separate refresh process.
When a user accesses a DirectLake report, the engine checks if the data is already in memory. If not, it reads the Parquet files directly from OneLake. There is no translation to SQL (like DirectQuery) and no redundant copy of the data (like Import).
Strengths of DirectLake
- Import-Level Performance: Because it uses the same in-memory engine as Import mode, the query speed is nearly identical to the fastest possible Power BI experience.
- No Refresh Needed: When the data in your Lakehouse changes, the DirectLake model can automatically see those changes without a manual or scheduled refresh.
- Scale: It can handle massive volumes of data because it only loads the specific columns needed for a query into memory, rather than the entire dataset.
Limitations of DirectLake
- Fabric Exclusive: You must be using Microsoft Fabric (Lakehouse or Warehouse) to use DirectLake. It doesn't work with external SQL Servers or Excel files.
- Fallback to DirectQuery: If the data model becomes too complex (e.g., using certain types of calculated columns) or if the Fabric capacity is under heavy load, the model might "fall back" to DirectQuery mode, which will significantly slow down performance.
- V-Order Dependency: To get the best performance, the Parquet files in OneLake should be "V-Ordered," a Microsoft-specific optimization that makes Parquet files even faster for the Power BI engine to read.
4. Comparison Table: At a Glance
| Feature | Import Mode | DirectQuery Mode | DirectLake Mode |
|---|---|---|---|
| Performance | Fastest (In-memory) | Slower (Depends on Source) | Fast (In-memory) |
| Data Freshness | Scheduled Refresh | Real-time | Near Real-time (Live) |
| Data Volume | Limited by Capacity Memory | Unlimited (Source dependent) | Very High (OneLake) |
| DAX Support | Full Support | Limited Support | Nearly Full Support |
| Source System Impact | High during refresh, zero during use | High during every user interaction | Low (Reads from OneLake) |
| Setup Complexity | Simple | Moderate (Requires Indexing/Optimization) | Moderate (Requires Fabric) |
5. Practical Examples and Code Snippets
To understand these modes better, let’s look at how they handle a common task: calculating Total Sales.
Scenario A: Import Mode
You are building a monthly financial report. The data doesn't change during the day. In Power Query (M), you might have a simple connection:
let
Source = Sql.Database("FinanceServer", "MonthlyData"),
Sales_Table = Source{[Schema="dbo",Item="FactSales"]}[Data]
in
Sales_Table
Once this is loaded, you write a DAX measure:
Total Sales = SUM(FactSales[Amount])
When a user clicks a year slicer, the VertiPaq engine instantly scans the Amount column in its local memory and returns the result.
Scenario B: DirectQuery Mode
You are building a dashboard for a logistics company to track package deliveries happening right now. When you write the same DAX measure:
Total Sales = SUM(FactSales[Amount])
Power BI does not calculate this itself. Instead, it generates a SQL query and sends it to the server:
SELECT SUM(Amount)
FROM dbo.FactSales
WHERE DeliveryDate = '2023-10-27';
If the FactSales table has 100 million rows and no index on DeliveryDate, the user will see a spinning loading icon for several seconds.
Scenario C: DirectLake Mode
You are using Microsoft Fabric to analyze retail trends across thousands of stores. The data is landing in a Lakehouse every few minutes via a Spark job. You don't need to write M code or schedule a refresh. You simply point your Power BI report to the Lakehouse table. The DAX remains the same:
Total Sales = SUM(FactSales[Amount])
The Power BI engine looks at the Delta Parquet files in OneLake. If the "Amount" column isn't in memory, it "pumps" that column into memory. The user gets the speed of Import, but as soon as the Spark job finishes the next batch of data, the Total Sales value updates automatically.
6. Step-by-Step: Choosing and Configuring the Mode
How to Choose
- Is your data in Microsoft Fabric?
- Yes -> Use DirectLake for the best performance and freshness.
- No -> Move to question 2.
- Do you need "Up-to-the-second" live data?
- Yes -> Use DirectQuery.
- No -> Move to question 3.
- Is your dataset small enough to fit in memory (under 1GB for Pro, or larger for Premium)?
- Yes -> Use Import mode. It is the most reliable and fastest for the end-user.
- No -> Consider DirectQuery or using Aggregations (a hybrid approach).
How to Set Storage Mode in Power BI Desktop
- Open Power BI Desktop and click Get Data.
- Select your source (e.g., SQL Server).
- In the connection dialog, you will see a radio button for Data Connectivity mode. Select either Import or DirectQuery.
- If you need to change the mode later, go to the Model View, select a table, and look at the Properties pane. Under the Advanced section, you can find the Storage Mode dropdown.
Warning: You can convert a table from DirectQuery to Import, but you usually cannot convert an Import table back to DirectQuery without recreating it. Always keep a backup of your file before switching modes.
How to Set Up DirectLake (Fabric)
- Upload your data to a Fabric Lakehouse or Warehouse.
- Ensure the data is in Delta format.
- In the Fabric workspace, click on the SQL Endpoint or the Lakehouse.
- Select New Power BI Dataset (now called "Semantic Model") from the top menu.
- Select the tables you want to include. This automatically creates a DirectLake connection.
7. Best Practices and Industry Recommendations
For Import Mode:
- Star Schema is King: Always organize your data into Facts (numbers) and Dimensions (filters). This is what the VertiPaq engine is designed for.
- Remove Unused Columns: Every column you import takes up memory. If you don't need a "Description" field that contains long paragraphs, don't import it.
- Use Integers where possible: VertiPaq compresses integers much better than long strings or decimal numbers.
For DirectQuery Mode:
- Optimize the Source: Ensure your SQL tables have proper indexes. If Power BI sends a query, the database should be able to answer it in under a second.
- Limit Visuals per Page: Each visual sends at least one query. A page with 30 visuals will overwhelm the database. Keep it to 5-10 high-impact visuals.
- Avoid Complex DAX: Try to do your heavy calculations in the SQL database (via a View) rather than in a DAX measure.
For DirectLake Mode:
- Monitor Fallback: Use the "Performance Analyzer" in Power BI Desktop to ensure your visuals aren't falling back to DirectQuery mode.
- V-Order your Tables: If you are using Spark to write data to your Lakehouse, ensure V-Order is enabled. In Fabric, this is often on by default, but it's worth verifying.
- Manage Capacity: DirectLake relies on Fabric Capacity (F-SKUs). Ensure your capacity is sized correctly for the amount of data you are loading into memory.
Callout: The "Composite Model" Hybrid You don't have to choose just one! A "Composite Model" allows you to have some tables in Import mode (like a Date table or a Product category table) and others in DirectQuery mode (like a massive Sales fact table). This gives you the speed of Import for your filters and the scale of DirectQuery for your data.
8. Common Pitfalls and How to Avoid Them
1. The "Select All" Trap in DirectQuery
When a user has a DirectQuery report and hits "Select All" on a slicer with thousands of values, Power BI might generate a SQL query with a massive WHERE clause (e.g., WHERE ID IN (1, 2, 3... 10000)). This can crash the query or cause a timeout.
- Solution: Use the "Apply" button on slicers so that queries are only sent once the user has finished making their selections.
2. Excessive Refreshing in Import Mode
Some developers set their Import models to refresh every 30 minutes, thinking they are providing "live" data. This often leads to refresh failures because the previous refresh hasn't finished before the next one starts.
- Solution: If you need data every 30 minutes, you should probably be using DirectQuery or DirectLake. Import mode is best suited for daily or hourly cadences.
3. DirectLake Fallback Issues
If you add a calculated column to a DirectLake table using complex DAX, the engine might decide it can't handle that in-memory and will "fallback" to DirectQuery. Suddenly, your fast report becomes slow.
- Solution: Perform as many transformations as possible in the "Gold" layer of your Lakehouse (using SQL or Spark) before the data reaches the Power BI Semantic Model.
4. Ignoring Security Performance
Row-Level Security (RLS) can significantly slow down DirectQuery. If the database has to calculate which rows a user can see for every single visual, the overhead adds up.
- Solution: Test your report performance with different user roles to ensure the security logic isn't killing the user experience.
9. FAQ: Common Questions
Q: Can I use DirectLake with an on-premises SQL Server? A: No. DirectLake requires the data to be in OneLake (Microsoft Fabric) in Delta Parquet format. To use on-premises data, you would first need to use a Data Factory pipeline to move that data into a Fabric Lakehouse.
Q: Is DirectQuery always slower than Import? A: Almost always, yes. Even with a perfectly tuned database, there is "network latency" (the time it takes for the query to travel to the server and back) that Import mode simply doesn't have.
Q: Does DirectLake cost more? A: DirectLake requires a Fabric Capacity subscription. Depending on your data volume and usage, this could be more or less expensive than a traditional Power BI Premium per User license. However, it often reduces costs because you don't need to pay for the "compute" of constant data refreshes.
10. Key Takeaways
- Import Mode is the go-to choice for performance and feature support, but it requires data to be copied and refreshed on a schedule.
- DirectQuery is essential for real-time requirements and massive datasets that exceed memory limits, but it places a heavy load on the source database and can be slow.
- DirectLake is a revolutionary option for Microsoft Fabric users, offering the high speed of Import mode without the need for traditional data refreshes.
- Query Folding is the most important concept to master for DirectQuery; without it, your reports will likely fail or perform poorly.
- Data Modeling (Star Schema) is still relevant in all three modes. A messy data model will perform poorly regardless of the connection type.
- Storage Mode is not permanent. You can often move from "Live" connections to "Import" connections as your requirements change, but plan carefully to avoid rework.
- Always monitor performance. Use the Performance Analyzer in Power BI to see exactly how long each visual takes to load and whether the time is spent on "Data Query" (the source) or "Other" (the Power BI engine).
By choosing the right connection mode at the start of your project, you set the foundation for a scalable, fast, and user-friendly reporting solution. Whether you are dealing with a small Excel file or a multi-petabyte data lake, understanding these three modes ensures you are using the right tool for the job.
Continue the course
Enjoying the courses?
Everything stays free. Pro shows fewer ads, doubles your daily points limit so you progress twice as fast, and lets you read each lesson on one page.
- ✓ Fewer advertisements
- ✓ 2× daily points limit
- ✓ Distraction-free lessons