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
Lutinho
Frequent Visitor

Load external code from .txt for custom column

Good afternoon community,

 

I have a problem that I am trying to solve. I have a bit of code (for a custom column) that is quite critical for our reporting but which is also annoying to maintain in 6 different reports.

 

With the help of a blogpost (https://blog.crossjoin.co.uk/2014/02/04/loading-power-query-m-code-from-text-files/) I tried to load the code for the custom column externally, but without results. 

 

The point is, I am only trying to load the code for a custom code externally, not all content of the advanced editor. 

 

When creating the custom column I tried code like this:
Expression.Evaluate(Text.FromBinary(Web.Contents("https://xxxxx.xxxx.x.xxx/Subvlak.txt")))

 

Where Subvlak.txt is just a plain .txt with content like this: 

if [Modul] = "035" or ([Modul] = "022" and [#"HPG-Code"] = "003") then "Datacenter" else "Blabla"

 

I then get an error like this: 

Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?

 

Anyone can help me with this? Thanks in advance!

 

With kind regards,

Lutijn

 

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @Lutinho

 

It's a cool idea. I'm afraid it's beyond my scope at present. Hope more people can see this post and give suggestions here. 

 

Best Regards,
Community Support Team _ Jing

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.