Forum Discussion

danb's avatar
danb
Resolver I
7 years ago
Solved

Convert Column from Text to Number in Direct Query

Hi Experts!  I am running into an issue around trying to convert a column that is connected via direct query from a database from "Text" to "Number" type. I know that the proper way to do this is to...
  • zoloturu's avatar
    7 years ago

    Hi danb,

     

    What if while connecting to a database using DirectQuery you will use NativeQuery, where you can do whatever you want?

    See example with CAST(CONVERT) below:

     

    DQ cast

    Regards,
    Ruslan
    -------------------------------------------------------------------
    Did I answer your question? Mark my post as a solution!

  • zoloturu's avatar
    zoloturu
    7 years ago

    danb,

     

    it acts as a SQL batch (syntax is unlimited). So if you enter a query as I mentioned then it will be send to the database (calculations done on db side) and a result will be returned to Power BI. Use just SELECT statement and you will be safe. 

     

    Regards,
    Ruslan
    -------------------------------------------------------------------
    Did I answer your question? Mark my post as a solution!