What is the best approach to convert a Date Time column to a Date data type in Power Query while using DirectQuery from SQL

+1 vote
What is the best approach to convert a Date/Time column to a Date data type in Power Query while using DirectQuery from SQL?

I'm working with a Power BI report that connects to an SQL database using DirectQuery. One of the columns is in Date/Time format, but I need it as a Date-only type for filtering and calculations. Since DirectQuery has limitations on certain transformations, what is the most efficient way to achieve this conversion? Should it be handled in SQL before the data reaches Power BI, or is there a Power Query workaround that preserves performance?
Feb 28, 2025 in Power BI by Evanjalin
• 36,180 points
1,070 views

1 answer to this question.

+1 vote

For DirectQuery, the best way to convert a Date/Time column to Date is at the SQL level for performance.

Best Approaches:

SQL Conversion (Recommended):

SELECT CAST(DateTimeColumn AS DATE) AS DateOnlyColumn FROM TableName;
  • Efficient, preserves query folding, avoids Power Query limitations.

Power Query with Native Query:

  • Use a custom SQL statement in Power Query to ensure SQL handles the conversion.

Avoid Power Query Transformations in DirectQuery as they may break query folding and hurt performance.

Best Practice: Always convert in SQL before data reaches Power BI.

answered Feb 28, 2025 by anonymous
• 36,180 points

Related Questions In Power BI

+1 vote
2 answers

What are the best practices for improving performance when using DirectQuery in Power BI to retrieve data from SQL Server?

For optimization in Power BI while using DirectQuery with SQL Server, best practices include the ...READ MORE

answered Jan 23, 2025 in Power BI by pooja
• 24,450 points
986 views
+1 vote
2 answers

What is the best approach for creating a live connection from Power BI to PostgreSQL?

The most convenient way to set up ...READ MORE

answered Dec 18, 2024 in Power BI by Vani
• 3,580 points
1,831 views
0 votes
1 answer

What is the best way to handle and display hierarchical data in Power BI?

To address filter inconsistencies in your Power ...READ MORE

answered Dec 18, 2024 in Power BI by anonymous
• 3,020 points

edited Mar 6, 2025 916 views
+1 vote
2 answers

How can I filter a dataset in Power BI to show records where a date column is less than the slicer value?

Filtering a dataset in Power BI to ...READ MORE

answered Jan 3, 2025 in Power BI by pooja
• 24,450 points
966 views
0 votes
1 answer

Which one should I choose Tableau or Power BI?

Hi Grim, Both the BI tools - Tableau ...READ MORE

answered Apr 6, 2018 in Tableau by ghost
• 1,800 points
2,081 views