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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SkorpionAAM
Helper V
Helper V

if custom column formula using M Language

I have table where i used 

this funcation which working fine 

 

if [operation_photo] = "" then "" else "***/1/layers/3633601/features/"&[ogc_fid]&"/"&"operation_photo/"&[operation_photo]&"/"&"?api_key=***"

 

but problem is in [operation_photo] column have some links like this http://Yahoo.com

 

which is correct so i need that method if there is proper link it like this http://Yahoo.com its give me this  and if not it will do this 

if [operation_photo] = "" then "" else "***/1/layers/3633601/features/"&[ogc_fid]&"/"&"operation_photo/"&[operation_photo]&"/"&"?api_key=***"

 

 

because at the moment this giving me this

 

https://*******/1/layers/3633601/features/10/operation_photo/https://dev.****.com/imglist/Storage/
02_747.jpg/?api_key=********

 

its should be like this

 

https://dev.****.com/imglist/Storage/02_747.jpg

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @SkorpionAAM 

Take a try to  change your M code as below:

= Table.AddColumn(#"Changed Type", "Custom", each if [operation_photo] = "" then "" else if Text.Contains([operation_photo], "https://") then [operation_photo]  else "***/1/layers/3633601/features/"&[ogc_fid]&"/"&"operation_photo/"&[operation_photo]&"/"&"?api_key=***")

Please check my test pbix file for more details.

126.png
If it doesn't meet your requirement,please feel free to ask.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

5 REPLIES 5
v-easonf-msft
Community Support
Community Support

Hi, @SkorpionAAM 

Take a try to  change your M code as below:

= Table.AddColumn(#"Changed Type", "Custom", each if [operation_photo] = "" then "" else if Text.Contains([operation_photo], "https://") then [operation_photo]  else "***/1/layers/3633601/features/"&[ogc_fid]&"/"&"operation_photo/"&[operation_photo]&"/"&"?api_key=***")

Please check my test pbix file for more details.

126.png
If it doesn't meet your requirement,please feel free to ask.

 

Best Regards,
Community Support Team _ Eason

PhilipTreacy
Super User
Super User

Hi @SkorpionAAM 

Sorry no I don't get your point that's why I asked if you could provide some sample data and examples of expected results.

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Untitled.png

 

 

So output will come like this 

https://*****/1/layers/3633601/features/"&[ogc_fid]&"/"&"operation_photo/"&[operation_photo]&"/"&"?api_key=*****

 

https://dev.tecsolutiongroup.com/imglist/Storage/02_196.jpg

 

 

and im usuing this M condition 

if [operation_photo] = "" then "" else "https://*****/1/layers/3633601/features/"&[ogc_fid]&"/"&"operation_photo/"&[operation_photo]&"/"&"?api_key=*****"

PhilipTreacy
Super User
Super User

Hi @SkorpionAAM 

This isn't clear.  Please show some sample data in a a table and the expected result.

But I think what you are saying is to return the [operation_photo] URL when the value in that column isn't null

if [operation_photo] = null then null else [operation_photo]

but all you will end up with is a dupliacte of the [operation_photo] column, so that can't be right?

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


see the Image which dont have links i create with this Condition 

if [operation_photo] = "" then "" else "https://*****/1/layers/3633601/features/"&[ogc_fid]&"/"&"operation_photo/"&[operation_photo]&"/"&"?api_key=*****"

 

now problem is who have already link it giving me like this 


https://****/1/layers/3633601/features/6/operation_photo/https://dev.tecsolutiongroup.com/imglist/Storage/
02_196.jpg/?api_key=***

i want who have already link thn dont concentare just give e result as it is if its not a link thn concentre

i think yo get my point

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.