Forum Discussion

meenakshiramdeo's avatar
meenakshiramdeo
Frequent Visitor
2 years ago
Solved

Keep double quotes as text

Hi All,

I am loading .csv file with "1252-Western European (Windows) Format where have description column conatining text. In this column some place double quote are part of data and I want to load it as it is but when source os loading it is excluding the double quote. I kept the file format as expecting some special character in source file.

For example file has data - "Date :02/03/2020\nmeeting :with"\n new message

but when it load in report it appear  -  Date :02/03/2020\nmeeting :with \n new message

 

So entire message is same just excluding double quote, why this strange behaviour happening.

Please help me on this.

 

Thanks in advance

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi meenakshiramdeo ,

     

    You want to retrieve " and replace all of it with """, you could try:

    Measure = SUBSTITUTE(MAX('Table'[Item]),"""","""""""")

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

     

     

5 Replies

  • TheoC's avatar
    TheoC
    Icon for Community Champion rankCommunity Champion

    Hi meenakshiramdeo 

     

    Double quotes, especially for CSV files, need to be '"doubled"' - it's called escaping the quotes from what I can see.  Can you try update your CSVs to '"Date :02/03/2020\nmeeting :with""\n new message"' and see if that corrects the issue?

     

    Alternatively, in Power Query, you can change the CSV format which may also change the CSV respective CSV parsers (i.e. use a different format to the "1252-Western European (Windows) Format" and see whether this corrects the issue).  

     

    Hope this helps.

     

    Theo

     

  • Thanks both , its working with replace " with """ but its really annoying or not correct to replace via find and replace option as not sure about the other content impact and its huge file. 

    Unfortunately I can't the .csv format as I am getting some other special charcter which support in this format only. 

    So is there any DAX query or formula for the same?

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi meenakshiramdeo ,

       

      You want to retrieve " and replace all of it with """, you could try:

      Measure = SUBSTITUTE(MAX('Table'[Item]),"""","""""""")

       

      Hope it helps!

       

      Best regards,
      Community Support Team_ Scott Chang

       

      If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

       

       

    • TheoC's avatar
      TheoC
      Icon for Community Champion rankCommunity Champion

      meenakshiramdeo you can do this in Power Query, not with DAX.  DAX will not provide the solution you're after because DAX is used in the front end of Power BI after the data has been loaded.

       

      1. Go to Power Query (Transform Data):

       

       

      2. In Power Query, go to Replace Values and replace the values appropriately.

       

      Let me know if you need further guidance!

       

      Theo 🙂