Forum Discussion
Extract the first two words separated by space
- 3 years ago
Hello EJA12 , We can do this easily using split columns in Power Query editor. But if you want to do this only in Power BI Desktop, you can use below DAX expressions:
My sample data is like this:
New column calculation will be like this:
Split = Var Replace_value = SUBSTITUTE(Data[Name]," ","+",2) Var Find_Value = FIND("+",Replace_value,1,0) Var Split_Value = IF(Find_Value>0,LEFT(Replace_value,Find_Value-1),Data[Name]) Return Split_ValueOutput looks like this:
If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!
Hello EJA12 , We can do this easily using split columns in Power Query editor. But if you want to do this only in Power BI Desktop, you can use below DAX expressions:
My sample data is like this:
New column calculation will be like this:
Split =
Var Replace_value = SUBSTITUTE(Data[Name]," ","+",2)
Var Find_Value = FIND("+",Replace_value,1,0)
Var Split_Value = IF(Find_Value>0,LEFT(Replace_value,Find_Value-1),Data[Name])
Return
Split_ValueOutput looks like this:
If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!