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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Concatenate texts in m - with special characters (?)

Hi all, I am trying to create a maps url in power query starting from Lat-Lon data. This works fine in DAX but I am unable to create a calculated column in m. The error I get is that "https:// etc." cannot be converted to type. For reference here below the code for the custom function.

Can you help me? 

 

= (lat,lon) =>
let
A="https://www.google.com/maps/search/?api=1&query=",
B=",",
lat=Number.toText(lat),
lon=Number.toText(lon),
R1=Text.Combine(A,lat),
R2=Text.Combine(R1,B),
Result=Text.Combine(R2,lon)
in
Result

 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

@Anonymous , you might change some statements this way,

 

R1=Text.Combine({A,lat}),
R2=Text.Combine({R1,B}),
Result=Text.Combine({R2,lon})

or

= (lat,lon) =>
let
A="https://www.google.com/maps/search/?api=1&query=",
Lat=Number.toText(lat), //better with a different variable name to avoid ambiguity
Lon=Number.toText(lon),
Result=Text.Combine({A,Text.Combine({Lat,Lon},",")})
in
Result

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks @CNENFRNL , this fix works great.

Can you please explain me the need for the {} in the code? I thought being both values "text" it was enough. Thanks

@Anonymous , according to the syntax

Text.Combine(texts as list, optional separator as nullable text) as text

the first parameter should be of type list, which means that all substrings to be combined should be populated into a list, e.g. {Lat, Lon}.

 

Btw, there's a shorthand for Text.Combine when it comes to 2 substrings,

#"Combined Texts" = "A" & "B"

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

CNENFRNL
Community Champion
Community Champion

@Anonymous , you might change some statements this way,

 

R1=Text.Combine({A,lat}),
R2=Text.Combine({R1,B}),
Result=Text.Combine({R2,lon})

or

= (lat,lon) =>
let
A="https://www.google.com/maps/search/?api=1&query=",
Lat=Number.toText(lat), //better with a different variable name to avoid ambiguity
Lon=Number.toText(lon),
Result=Text.Combine({A,Text.Combine({Lat,Lon},",")})
in
Result

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.