Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to write quotation marks as text string in DAX?

Hello,

 

I need to write an URL in DAX that includes quotation marks "" but I'm not able to write them correctly as string.

I want to write this:

filter="documentId=123"
 
I tried this way and I get an error:
"filter="documentId=123""
And I also tried using two quotation marks but in the web browser I get two " too:
"filter=""documentId=123"""

 

How should I write them to appear correctly?

Thank you in advance.

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hello,

    The problem with that is when you open the link it appears with double " in the browser.

    Anyway, I was able to solve the proble using %22 which is the code for quotation marks in html.

     

    Thank you for your help. Kind regards!

4 Replies

  • Seanan's avatar
    Seanan
    Icon for Solution Supplier rankSolution Supplier

    Hi Anonymous 

    Is it just 1 URL? You can try something like the following code (Used in a calculated column):

    StringQuotes = VAR LeftText = CONCATENATE(LEFT('Table (2)'[Column1],7),"""") VAR RightText = CONCATENATE(RIGHT('Table (2)'[Column1],14),"""") return CONCATENATE(LeftText,RightText)

    Output:

     

     

     

     

     

     

    Kind regards,
    Seanan
    If this post helped, please consider accepting it as the solution.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Seanan,

       

      Than you for your answer. Unfortunately, I need to use a measure instead of a calculated column, as I'm using the USERPRINCIPALNAME() function.

      This is my current code

      URL = IF(
         HASONEVALUE(Table[Column1]), 
          "https://xxxxxx&user=" & USERPRINCIPALNAME() & "xxxxxx&filter=""documentId=" & VALUES(Table[Column1]) & """", 
         BLANK()
         )
      • Seanan's avatar
        Seanan
        Icon for Solution Supplier rankSolution Supplier

        Hi Anonymous 

        Would it be viable to add the quotation marks into your already existing measure? If so you can add extra quotation marks in your measure like this:

        String = IF(HASONEVALUE('Table (2)'[Column1]),"""Testing""")

        Result:

         

         

         

         

         

        Kind regards,
        Seanan
        If this post helped, please consider accepting it as the solution.