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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Alma1992
Regular Visitor

concatenates in Power BI

Hi. I have got this formula that work in excel I want to do it in power BI. How can I do it, can you please advise? Thanks in advance!

=IF(LEFT(H2, LEN(MID(G2, 6, LEN(G2)-6))) = MID(G2, 6, LEN(G2)-6), "+" & MID(G2, 6, LEN(G2)-6) & MID(H2, LEN(MID(G2, 6, LEN(G2)-6))+1, LEN(H2)), "+" & MID(G2, 6, LEN(G2)-6) & H2)

Alma1992_0-1710862607069.png

 

2 ACCEPTED SOLUTIONS
Daoud_H
Helper I
Helper I

Hi @Alma1992,

 

You can create a DAX measure like this : 

IF(
    LEFT([H2], LEN(MID([G2], 6, LEN([G2])-6))) = MID([G2], 6, LEN([G2])-6),
    "+" & MID([G2], 6, LEN([G2])-6) & MID([H2], LEN(MID([G2], 6, LEN([G2])-6))+1, LEN([H2])),
    "+" & MID([G2], 6, LEN([G2])-6) & [H2]
)

View solution in original post

Anonymous
Not applicable

Hi @Alma1992 

Based on your description, you want to extract the number .

In power query you can add a custom column, and input the following code.

Text.Select([WebFrom.Country Code],{"+","1".."9"})&Text.From([WebFrom.Phone])

Output

vxinruzhumsft_0-1710990161199.png

Herer is the M code in advanced editor, you can refer it.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc5NCgIxDAXgq0hXirOY/DXpVhAVN4K4Gnr/a/jSoYhvlTZfm2xbUWevRGUpn/fheKYTKmJRqx4tSl92gjMatwuIahp38hBCpgk8Q+NxhRGTROFr48zPiP2N4pW0iqpOkbNx/8pfbJDWxKohk7CMZe5PkDAehqoGUnr/Ag==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [BookId = _t, #"WebFrom.Country Code" = _t, WebFrom.Phone = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"BookId", Int64.Type}, {"WebFrom.Country Code", type text}, {"WebFrom.Phone", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Select([WebFrom.Country Code],{"+","1".."9"})&Text.From([WebFrom.Phone]))
in
    #"Added Custom"

Best Regards!

Yolo Zhu

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

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Alma1992 

Based on your description, you want to extract the number .

In power query you can add a custom column, and input the following code.

Text.Select([WebFrom.Country Code],{"+","1".."9"})&Text.From([WebFrom.Phone])

Output

vxinruzhumsft_0-1710990161199.png

Herer is the M code in advanced editor, you can refer it.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc5NCgIxDAXgq0hXirOY/DXpVhAVN4K4Gnr/a/jSoYhvlTZfm2xbUWevRGUpn/fheKYTKmJRqx4tSl92gjMatwuIahp38hBCpgk8Q+NxhRGTROFr48zPiP2N4pW0iqpOkbNx/8pfbJDWxKohk7CMZe5PkDAehqoGUnr/Ag==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [BookId = _t, #"WebFrom.Country Code" = _t, WebFrom.Phone = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"BookId", Int64.Type}, {"WebFrom.Country Code", type text}, {"WebFrom.Phone", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Select([WebFrom.Country Code],{"+","1".."9"})&Text.From([WebFrom.Phone]))
in
    #"Added Custom"

Best Regards!

Yolo Zhu

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

 

Daoud_H
Helper I
Helper I

Hi @Alma1992,

 

You can create a DAX measure like this : 

IF(
    LEFT([H2], LEN(MID([G2], 6, LEN([G2])-6))) = MID([G2], 6, LEN([G2])-6),
    "+" & MID([G2], 6, LEN([G2])-6) & MID([H2], LEN(MID([G2], 6, LEN([G2])-6))+1, LEN([H2])),
    "+" & MID([G2], 6, LEN([G2])-6) & [H2]
)

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.