powerbipowerquery

IF second char in value is 'X' output should be existing first char + 'X'


need and assistance, please. Need to create new column.In column Company i have few values like D 00, DEXI, DX00, DX. I need to make a statement: Everytime when second char in cell is "X" or " " should return me DX, else should return me two first chars like DE(second example). Same situation whith other letters, when I have WX, W 00 and so on.


Solution

  • You can also try this

    =if Text.Middle([Input],1,1)=" " then Text.Start([Input],1) & "X" else Text.Start([Input],2)
    

    enter image description here