Forum Discussion
Anonymous
4 years agoNot applicable
Split text and stick together using DAX
I have a column which contains last name, fist name, and email. I want to get first name and last name from that usnig DAX.
I have tried using FIND with LEFT, but wasn't successful.
Looking forward to your help.
Example data
| No | Person |
| 1 | Smith, John, [email protected] |
| 2 | Morris, Elena, [email protected] |
| 3 | Anderson, Jack, [email protected] |
| 4 | Harris, Mari, [email protected] |
Output
| No | Person | Name |
| 1 | Smith, John, [email protected] | John Smith |
| 2 | Morris, Elena, [email protected] | Elena Morris |
| 3 | Anderson, Jack, [email protected] | Jack Anderson |
| 4 | Harris, Mari, [email protected] | Mari Harris |
Thanks
- Anonymous4 years ago
Hi Anonymous
M is more intuitive...
Column = VAR firstP = SEARCH(",",[Person],1) VAR secondP = FIND(",",[Person],firstP+1) RETURN MID([Person],firstP+1,secondP-firstP-1)&" "&LEFT([Person],firstP-1)
2 Replies
- mahoneypatMicrosoft Employee
This would be much easier in the query editor. Why not do it there?
Pat
- AnonymousNot applicable
Hi Anonymous
M is more intuitive...
Column = VAR firstP = SEARCH(",",[Person],1) VAR secondP = FIND(",",[Person],firstP+1) RETURN MID([Person],firstP+1,secondP-firstP-1)&" "&LEFT([Person],firstP-1)