Forum Discussion
Change data type using direct query
In direct query mode, we are able to select the data type in the Modeling tab. But before doing that, we should make sure the column has valid values. For example, if you want to convert a column values to Date type, there shouldn’t exist any weird value.
Best Regards,
Herbert
Hi Herbert,
Thank you for your response.
I've already tried using the date function on the Modeling tab.
This data is coming from our SAP production environment, but to double check, I imported my date columns to make sure there are no weird values, and there are none.
First, SAP has the date values stored as varchar. Power BI is unable to convert directly from varchar to date (img 1), so in the Query I have to use either to_date or cast as date in order to bring a new column to my report. Once I bring my new column into the report, Power BI recognizes it as a Date automatically, and I'm able to filter my data using a normal slicer. (img 2) But when trying to filter my data using the Timeline visual or any filtering on this column, I get the following error (img 3).
Thanks again!
Julia