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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Kandarp
Helper I
Helper I

Control SQL query in direct query mode

Hi,

 

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

I have created date table in power bi like below : 

 

Kandarp_0-1664521700318.png

 

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

 

Kandarp_1-1664521752401.png

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 : 

Kandarp_2-1664521987449.png

 

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.

 

1 REPLY 1
lbendlin
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

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.