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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Format Text Column as Phone Number in same column only using Power Query

Hello,

 

I've got a text column with phone numbers in the format "##########" and I want to convert it to the format "(###) ###-####". I've seen another thread that talks about splitting the column and recombining into another column, but I want to avoid that many transformations. I can't use DAX (I'm consuming this dataset elsewhere).

 

I might be trying to be too clever about it, but I feel like this is possible using a combination of Table.TransformColumns, Text.Format, and Text.ToList like this:

 

 

= Table.TransformColumns(#"Previous Step", {{"Unformatted Phone Number Column", each Text.Format("(#{1}#{2}#{3}) #{4}#{5}#{6}-#{7}#{8}#{9}#{10}",Text.ToList(_), type text}}))

 

 

I feel like this is close, but I can't quite work out the syntax. Any tips?

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

hello, @Anonymous 

= Table.TransformColumns(
    #"Previous Step", 
    {"Unformatted Phone Number Column", 
     (x) => Number.ToText(Number.From(x), "(000) 000-0000")}
)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thank you both! Both good options, but I went with @AlienSx since it seems a little cleaner

AlienSx
Super User
Super User

hello, @Anonymous 

= Table.TransformColumns(
    #"Previous Step", 
    {"Unformatted Phone Number Column", 
     (x) => Number.ToText(Number.From(x), "(000) 000-0000")}
)
Daryl-Lynch-Bzy
Community Champion
Community Champion

Hi @Anonymous 

You could try the following transformation:

= Table.TransformColumns( #"Previous Step" , {{ "Custom", each "(" & Text.Range( _ , 0, 3 ) & ") " & Text.Range( _ , 3, 3 ) & "-" & Text.Range( _ , 6, 4 ) , type text}})

This is a good resource for learning about all the Text functions in Power BI.


Text Functions in Power Query M (150+ Examples) - BI Gorilla

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.