Reply
Fernandofrancis
Frequent Visitor
Partially syndicated - Outbound

Change Direct Query of Visual

Hello,

I'm using Direct Query to access a large table in an Oracle Database.  Is it possible to change the query that power bi send to the database, to fill a Card for exemple? I got the query using Performance Analyzer and I think is possible improve the performance just changing the its syntax. Another exemple is the calendar dimesion, when I set two dates the power bi uses IN clause: "DTHORA IN (TO_DATE('2020-08-05 00:00:00', 'YYYY-MM-DD HH24:Mi:SS'), TO_DATE('2020-08-06 00:00:00', 'YYYY-MM-DD HH24:Mi:SS') ...)"

When the best way to do that is use clause BETWEEN.

1 ACCEPTED SOLUTION
nandukrishnavs
Super User
Super User

Syndicated - Outbound

@Fernandofrancis You cannot directly modify the query generated by Power BI. But you can change the DAX measure and you can see a slight variation in the SQL query. In addition, you could write a native query to calculate the value of the visual card and use that table on the card. But you may lose interaction between other visuals.

When you use the archived date in the slicer, it will generate the IN condition. An alternative option is to use Integer instead of the date field.


Regards,
Nandu Krishna

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

Syndicated - Outbound

@Fernandofrancis , not possible to change query. But can try to change the measure to see if you get the desired query

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
nandukrishnavs
Super User
Super User

Syndicated - Outbound

@Fernandofrancis You cannot directly modify the query generated by Power BI. But you can change the DAX measure and you can see a slight variation in the SQL query. In addition, you could write a native query to calculate the value of the visual card and use that table on the card. But you may lose interaction between other visuals.

When you use the archived date in the slicer, it will generate the IN condition. An alternative option is to use Integer instead of the date field.


Regards,
Nandu Krishna

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)