Warm tip: This article is reproduced from stackoverflow.com, please click
dax powerbi powerbi-desktop azure-sql-server

Power BI is converting date to datetime

发布于 2020-03-29 21:00:26

I have a PowerBI report connected to Azure SQL Direct Query Mode (Advanced Option - where we can write SQL Statements).

I got date column in SQL DB (date type), but PowerBI is converting this to datetime, even it’s in date type in SQL DB. Now I cannot transform this column in PowerBI as its Direct Query. However, if I connect directly to table (Direct Query mode only, but not advanced option) it takes date column as date.

Sample Date values:

created_date
2002-02-19
2002-02-19
2002-02-19
2002-02-19
2002-02-19

Converted Date values by PowerBI

created_date
19-02-2002 00:00:00
19-02-2002 00:00:00
19-02-2002 00:00:00
19-02-2002 00:00:00
19-02-2002 00:00:00

Any inputs on this will be highly appreciated.

Thank you,

Questioner
Ruchita P
Viewed
63
1,589 2020-01-31 19:11

That's a known problem, even if you use CAST or CONVERT to force the datatype in the query PowerBI will format it as a DateTime.

You can change it thought, from the report view:

  1. select the field (in the field bar)
  2. open the "Modeling" section in the top bar, here you will be able to change the data type and formatting of the field to Short Date