Forum Discussion

RamiDaoud's avatar
RamiDaoud
Frequent Visitor
5 years ago

Remove White Spaces between decimal digits

Hello, I have Latitude column with Decimal type and there are some spaces between the digits. My question is how I can remove the spaces? .  I tried trim function which required changing the type from Decimal to Text and when I changed the type I have strange values.

The following explain the case: Thank 

Latitude(Current)Latitude (After cleaning)
32.  5674432.56744
  32. 56 47232.56472
3 2.1  2   36032.12360
  

8 Replies

  • CNENFRNL's avatar
    CNENFRNL
    Community Champion

    Hi, RamiDaoud , Text.Remove does the trick for you.

    Table.AddColumn(Source, "Custom", each Text.Remove([Latitude], " "))

    • RamiDaoud's avatar
      RamiDaoud
      Frequent Visitor

      I tried it but I recived the follwoing error: 

      Expression.Error: The value isn't a single-character string.

      Thank you

      • Jimmy801's avatar
        Jimmy801
        Community Champion

        Hello RamiDaoud 

         

        are you sure the second parameter is a " " and not a string with 2 characters?

         

        BR

         

        Jimmy

  • Icey's avatar
    Icey
    Community Support

    Hi RamiDaoud ,

     

    Is this problem solved?

     

    If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

     

    If not, please share us a dummy .pbix file with the same issue. Please remove real data and sensitive information.

     

     

    Best Regards,

    Icey

    • RamiDaoud's avatar
      RamiDaoud
      Frequent Visitor

      Hello,

      Unfortunatly, the problem has not been solved yet. I will share the file soon. 

      Thanks,

      • CNENFRNL's avatar
        CNENFRNL
        Community Champion

        RamiDaoud , as Jimmy801 mentioned, embedded Text.From() function will do the trick,

        Table.AddColumn(Source, "Custom", each Text.Remove(Text.From([Latitude]), " "))