Forum Discussion

amirghaderi's avatar
amirghaderi
Icon for Helper IV rankHelper IV
4 years ago
Solved

Remove unnecessary character from data

Hi,

In the below example, how can I romove "A" and "*" when my data get loaded to power BI.

Basically, I want my data to be loaded as Date type to Power Bi. But, some records have additional character as "A" and "*".

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi amirghaderi ,

     

    My mistake.

    Actually you could directly use Replace Values feature in Query Editor.

     

    Best Regards,

    Jay

5 Replies

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

    In Power Query click the column and then add column from example. (There's a drop down to do it based on selection). Just type in a few examples of what you want. If month is always 3 characters it will generate something simple.

     

    Once done set your new column as date type, delete old one and rename.

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

    amirghaderi 

     

    Based on the sample data you sent to us.. you can try the following formula:

     

    Date_New = DATEVALUE(LEFT(Sheet1[Date],10))
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi amirghaderi ,

     

    You could use themistoklis 's method if the unnecessary character always appears at the end of column.

    If it will appear in other places, you can try using the TEXT.REMOVE() function in Query Editor to create a new column and then change the type of new column to date.

    Text.Remove([date],{"A","*"})

     

     

    Best Regards,

    Jay

    • amirghaderi's avatar
      amirghaderi
      Icon for Helper IV rankHelper IV

      Thanks,

      In formula, if I have as below, it will remove A from any month which has A, like April,

       

      = Table.AddColumn(#"Promoted Headers", "Custom", each Text.Remove([Date],"A"))

       

       

       

      If I put one space before A, then the formula, gives an error.

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi amirghaderi ,

         

        My mistake.

        Actually you could directly use Replace Values feature in Query Editor.

         

        Best Regards,

        Jay