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
Steeks91
New Member

UDF (User Defined Functions) in semantic model in Fabric?

Hi!
We've discover the concept of UDFs and would very much like to use it. However I don't see any way of updating the semantic model with the code like I see in the demos. 
We're working in desktop towards a semantic model in Fabric, using direct lake. Is this functionality not yet released for those models or for direct lake?
If not, do we have any idea of when it will be released? 

Thanks,

Stefan

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Steeks91 ,

 

To my test this works correctly in the Direct Lake mode, in my case it asked me to do an updagrade of the compatability level of the semantic model but implemented the new logic.

 

It's still on preview but it's usable. How are you creating the function using the TMDL script or the DAX editor?

 

To generate the function you need to do it on the TMDL script, I have seen some problems using the DAX editor.

 

My general code is:

createOrReplace

	/// Optional description above the function
	function Test =
			( a: expr,  b: int64    ) =>
			
			a+b

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @Steeks91 ,

 

To my test this works correctly in the Direct Lake mode, in my case it asked me to do an updagrade of the compatability level of the semantic model but implemented the new logic.

 

It's still on preview but it's usable. How are you creating the function using the TMDL script or the DAX editor?

 

To generate the function you need to do it on the TMDL script, I have seen some problems using the DAX editor.

 

My general code is:

createOrReplace

	/// Optional description above the function
	function Test =
			( a: expr,  b: int64    ) =>
			
			a+b

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Amazing - you're a genius! Thank you very much! 
I was using DAX editor. 
When using TMDL I just got this message, but after accepting it worked. When editing in desktop mode it works. However, when looking at the semantic model in the browser I don't see "funtions". I don't mind but just a FYI if someone else sees this. 

 

e2649956-f9d5-43b2-b239-ee01870d9979.png


Thanks @MFelix !! 

Hi @Steeks91 ,

 

This feature is still under developement so it does not show in the service that is correct and even more if you add a measure with that UDF it will return error:

MFelix_0-1762445753146.png

 

However it works properly and you can use it to add measures to your semantic model, just be aware that since you are in Direct Lake mode the use of UDF need to be done at semantic model level you cannot use it in Report Measures.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors