cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Within M Language change "Last, First" Name to "First Last"?

Hi all,

 

Thank you to everyone for this continued support on this community.  It has been incredibly helpful with getting through this project.  So continuing that path...

 

I have code that looks as follows:

 

DetailColumns = Table.ExpandRecordColumn(RecordsOfPage, "PageData", {"FullName", "Field1","Field2","Field3"}​ 

 

[FullName] returns Last, First name (i.e. "Smith, Joe").  I need to transform this to "Joe Smith".

 

I suspect it has something to do with the function: Text.BeforeDelimiter([FullName], ",", 0), type text) and Text.AfterDelimiter([FullName], ",", 0), type text) <--NOTE: SYNTAX MAY/MAY NOT BE CORRECT

 

However, I'm not familiar enough with the M language to how exactly embed this within the ExpandRecordColumn line of code.  I tried to do it afterwards by pulling [FullName] twice, but I can't pull the same field twice.  Advice going either direction would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Within M Language change "Last, First" Name to "First Last"?

Hi @bflury ,

 

Try this code on add a new column for Power Query:

 

Text.Combine(List.Reverse(Text.Split([Column1],",")), " ")

 

Capture.PNG

 

Did I answer your question? Mark my post as a solution!
Ricardo


Did I answer your question? Mark my post as a solution!
Ricardo

View solution in original post

3 REPLIES 3
Highlighted
Super User I
Super User I

Re: Within M Language change "Last, First" Name to "First Last"?

Try using 'Add Column from examples' to see what powerbi comes up with.  Give it some good examples .

Highlighted
Community Champion
Community Champion

Re: Within M Language change "Last, First" Name to "First Last"?

Hi @bflury ,

 

Try this code on add a new column for Power Query:

 

Text.Combine(List.Reverse(Text.Split([Column1],",")), " ")

 

Capture.PNG

 

Did I answer your question? Mark my post as a solution!
Ricardo


Did I answer your question? Mark my post as a solution!
Ricardo

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Within M Language change "Last, First" Name to "First Last"?

@camargos88  Brilliant!!!  Thank you!

 

And thank you to everyone here for suggestions and feedback.

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors
Top Kudoed Authors