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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Helper I
Helper I

Control SQL query in direct query mode



I am using Direct Query mode in my power bi report.

I have created date table in power bi like below : 




I am also using special dates (e.g. Last 7 days, Last Month). So I have created that power bi table like below : 



I gave relationship to both the above tables using Date. 


Question : When I use date slicer to filter my report, SQL query automatically generated and it uses Where Dates IN (dt1,dt2) query. Due to large date range, IN operator works slow. Please see below screenshot : 



Is there any way I can control this query or change my implementation of report so that query should be where Dates Between 'dt1' and 'dt2'.  So that it improves overall result time.


Super User
Super User

Change your implementation.  Maintain your dates table in SQL (table or view), and - ideally- change it to import mode with daily refresh.  There is really no need to recompute that table for every query,

Helpful resources

Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City


Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.