Connecting Power BI to Databases: Import vs. DirectQuery

Choose the right connection mode when working with SQL Server, Postgres, Snowflake, and other databases.

Moving from local files to database connections opens up powerful capabilities in Power BI, but choosing the right connection mode is essential. Here are three key takeaways from this video:

  • Import mode copies data into Power BI for fast, flexible reporting. Data is stored in the in-memory model, visuals load quickly, DAX functionality is unrestricted, and the report works even when the database is offline. The trade-off is that data is only as current as the last refresh.
  • DirectQuery keeps data in the database for near real-time access. Every visual interaction sends a live query to the source, which provides up-to-the-minute data but depends on database and network performance. Some DAX features are restricted in this mode.
  • Import is the right choice for most scenarios. Unless you genuinely need real-time data or your dataset is too large to import, import mode delivers the best performance, the most modeling flexibility, and the smoothest experience for report viewers.

This lesson is a preview from our Power BI Certification Course Online (includes software & exam). Enroll in this course for detailed lessons, live instructor support, and project-based training.

When you first start with Power BI, most data comes from local files such as Excel spreadsheets and CSVs. But as reporting needs grow, connecting directly to databases becomes essential. Power BI supports a wide range of database platforms including SQL Server, Postgres, Snowflake, and many others, each accessible through built-in connectors. When connecting to any of these sources, the first decision you need to make is which connection mode to use: Import or DirectQuery.

Import Mode

Import mode is the default connection method in Power BI, and for good reason. When you use Import, the data is copied from the database into Power BI's internal in-memory data model. Once imported, the data lives inside your Power BI file and all visual interactions query this local copy rather than the source database.

This approach delivers several advantages. Performance is excellent because the in-memory engine is optimized for the types of queries that Power BI visuals generate. All DAX functionality is available, including calculated columns, calculated tables, and complex transformations. The report continues to work even if the database goes offline, since the data is stored locally. The trade-off is that your data is only as current as the last refresh. You can schedule refreshes in the Power BI Service, even multiple times per day, but between refreshes, the report reflects a snapshot of the data rather than the live state of the database.

DirectQuery Mode

DirectQuery takes a fundamentally different approach. Instead of copying data into Power BI, the data stays in the database. Every time a user interacts with a visual, applies a filter, or clicks on a data point, Power BI sends a query to the database in real time and displays the returned results.

The primary advantage is that data can be near real-time, reflecting the current state of the source. This makes DirectQuery appropriate for scenarios where up-to-the-minute accuracy is a genuine requirement. However, the trade-offs are significant. Performance depends entirely on the database and network speed. Reports with many visuals, complex filters, or many concurrent users can become slow because each interaction generates a new query. Some DAX features are restricted because transformations need to remain foldable, meaning they must be translatable into queries that the source database can execute. Additionally, the Power BI Service must maintain live access to the database through credentials and potentially a gateway or cloud connection.

Choosing the Right Mode

For most reporting scenarios, Import mode is the better choice. It provides the smoothest interactive experience for report viewers, the greatest flexibility for data modeling and DAX calculations, and reliable performance regardless of database load or network conditions. Scheduled refreshes can bring data as close to current as most business needs require.

DirectQuery should be reserved for situations where you truly need real-time data, not just where you think you might. It is also appropriate when the dataset is too large to import or when refresh times are prohibitively long. Before choosing DirectQuery, ensure that your database server is optimized to handle the additional query load, as poorly tuned databases can result in a frustrating experience for report viewers.

Connecting to a Database

The connection process itself is straightforward. From the Home tab in Power BI Desktop, select Get Data and choose your database type. Enter the server address and database name, select your connection mode (Import is the default), and provide your credentials. The authentication method depends on your database configuration, and your IT department can advise on the correct approach for your organization.

Once connected and authenticated, Power BI displays the available tables. You can select the tables you need, optionally apply transformations in Power Query, and load the data. From that point forward, the imported data behaves exactly as it would if it had come from a local file. The difference is that when you refresh, Power BI pulls the latest data from the live database rather than rereading a static file. Your connection settings and credentials are stored in the file, so you do not need to re-enter them each time you refresh.

photo of Dan Rodney

Dan Rodney

Dan Rodney has been a designer and web developer for over 20 years. He creates coursework for Noble Desktop and teaches classes. In his spare time Dan also writes scripts for InDesign (Make Book Jacket, Proper Fraction Pro, and more). Dan teaches just about anything web, video, or print related: HTML, CSS, JavaScript, Figma, After Effects, Premiere Pro, Photoshop, Illustrator, InDesign, and more.

More articles by Dan Rodney