Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
OH_Sport
New Member

DAX Formula Replace letters of the first word

Hi Guys,

i am beginnfer of DAX and PowerBI and hope that you can help me
i have to adjust the name in a data sheet


Current Name: Max Hartwig
Target: M. Hartwig.
Remain first letter, replace all letters of the second word with a "." and remain second word.


I do not get the solution in the DAX in Power BI.

1. create custom column

2. New Columnd name - Player ID

3. Custom column formula

How do i write the dax formula to express the data in the right manner?

6 REPLIES 6
Anonymous
Not applicable

Hi @OH_Sport 

 

Thank you FreemanZ for your interest in this thread and the great replies.
The solution FreemanZ provided in his reply was to create new columns via DAX.
If you want to implement this in Power Query with M, you can use the following code:

= Table.AddColumn(#"Changed Type", "NewName", each Text.Start(Text.BeforeDelimiter([Name], " "), 1) & ". " & Text.AfterDelimiter([Name], " "))

vxianjtanmsft_0-1733103552184.png

 

Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

OH_Sport
New Member

Hi @FreemanZ 

Thank you for your answer and the possible solution.
I am looking for a DAX Code, so that only on step is necessary - and i can learn to handle the DAX better in the future...

hi @OH_Sport ,

 

then try like:

column =

LEFT([Name], 1)&". "&PATHITEM(SUBSTITUTE([Name], " ", "|"), 2)

OH_Sport_0-1732909862808.png

It do not work - what i am doing wrong?

 

hi @OH_Sport ,

 

i think you might be confused between caculated column with DAX and custom column in Power Query with M.

 

https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-calculated-column

 

https://learn.microsoft.com/en-us/power-query/add-custom-column

 

FreemanZ
Super User
Super User

hi @OH_Sport ,

 

in Power Query, try like:

1. split the name column by delimiter, space in your case

2. extract the first letter of the name.1

3. merge name1 and name2 with space

 

 

for more info:

https://learn.microsoft.com/en-us/power-query/split-columns-delimiter

https://community.fabric.microsoft.com/t5/Desktop/I-need-to-Extract-first-3-character/td-p/2659241

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.