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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Fernandofrancis
Frequent Visitor

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

@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

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
nandukrishnavs
Super User
Super User

@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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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