Forum Discussion

RickHantz's avatar
RickHantz
New Member
10 years ago
Solved

"How to prevent Power BI from converting text data?"

We have data with lots of product codes that get auto converted to dates or scientific notation.

To prevent the conversion, we import the csv files as text to excel and save as xlsm.

However, Power BI still auto converts them into nonsense.

Are we missing a setting or technique to prevent the auto conversion?

 

thanks,

 

RickH

  • wonga's avatar
    wonga
    10 years ago

    RickHantz, try disabling the two highlighted items in below image:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Otherwise, try the following:

     

    When you load data into Power BI Desktop instead of clicking "Load", click "Edit" instead (which opens the Query Editor) and remove all steps after the "Source" or "Navigation" step (depending on if it's Excel or CSV, since Excel can have multiple sheets ,"Navigation" would be required to select the appropriate sheet whereas CSV's are only one sheet). By doing this, you will retain the source data without any modifications being done by Power BI automatically.

     

10 Replies

  • CahabaData's avatar
    CahabaData
    Icon for Memorable Member rankMemorable Member

    since you say Date or Scientific Notation : I am wondering when you look at the table data view's field type - what is it saying?

     

    also in Query Editor;  if the field type is not saying 'text' - and you change it to text - does the display correct itself?

     

    • RickHantz's avatar
      RickHantz
      New Member

      No, once its converted from text to a date or number, the original data is lost.

      Opening the spreadsheet in Power BI converts it; it’s too late to change the column types.

       

      (In the news, the gene research community has been bit by this Excel auto conversion, corrupting data published as Excel spreadsheets.)

       

      I was thinking of adding an apostrophe by macro to all the data in columns that are affected. Going to try that next.

       

      -RickH

       

       

  • wonga's avatar
    wonga
    Icon for Continued Contributor rankContinued Contributor

    RickHantz I don't have access to Power BI right now, but isn't there an option under File -> Options -> Options -> Data Load about performing implicit transformations when loading data into Power BI?

     

    I know there was an option about auto detecting relationships, there should be something similar for transformations.

    • RickHantz's avatar
      RickHantz
      New Member

      There is one to turn off auto date conversions, but not for EE.

      • wonga's avatar
        wonga
        Icon for Continued Contributor rankContinued Contributor

        RickHantz, try disabling the two highlighted items in below image:

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

         

        Otherwise, try the following:

         

        When you load data into Power BI Desktop instead of clicking "Load", click "Edit" instead (which opens the Query Editor) and remove all steps after the "Source" or "Navigation" step (depending on if it's Excel or CSV, since Excel can have multiple sheets ,"Navigation" would be required to select the appropriate sheet whereas CSV's are only one sheet). By doing this, you will retain the source data without any modifications being done by Power BI automatically.

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    I know this is from years ago, but just adding an alternate solution.

     

    Rather than trying to prevent PowerBI from changing the type, let it change it as per default. Then go into Query Editor, and change the type for the one column for which you wish to change the type. It is probably easier to add this one step rather than to manually set the data type for multiple columns.

     

    If you want to "intercept" this when you're first loading the data, click on "Transform data" to go straight to the Query Editor before the data gets loaded.