Search code examples
powerbidaxdata-analysispowerbi-desktopdata-cleaning

Powerbi: remove part of the string value in column and put it to another table


I have values in powerbi column with prefix e.g. Title: some title. I want to put this column to another table using dax, but without prefix "Title: " so it should be "some title".

In source table values can contain this prefix but there could be some values that do not have it.

Old column new column
Title: some title some title
Title: sky sky
Apple Apple
Title: xxx Title xxx Title

Solution

  • You can also create a calculated table :

    Attempt = 
    SELECTCOLUMNS(
        TitleTable,
        "Old Column", [Old Column],  
        "New Column",                
        IF(
            FIND("Title: ", [Old Column], 1, LEN([Old Column]) + 1) = 1,
            TRIM(MID([Old Column], LEN("Title: ") + 1, LEN([Old Column]))),
            [Old Column]
        )
    )
    

    enter image description here