For optimization in Power BI while using DirectQuery with SQL Server, best practices include the following:
Use Query Folding: By pushing transformations back to SQL Server for processing, query folding reduces the load on Power BI and minimizes data transfer.
Optimize SQL Server Queries: Properly index tables, use materialized views, and make sure that SQL queries are efficient so that the execution time is less.
Minimize Data Volume: Only import necessary columns and rows into Power BI. Filter out unnecessary data at the query level.
Limit Visual Complexity: Minimize the number of visuals and avoid complex DAX calculations that call for multiple queries.
Optimize Relationships: Maintain simple relationships and apply single-direction filters to avoid complexity.
Use Aggregations: Incentivize aggregated tables so summarized data can be pulled much quicker; avoid pulling raw data at a detailed level.
These practices help reduce latency and improve query efficiency when using DirectQuery with SQL Server.