Forum Discussion

Steeks91's avatar
Steeks91
New Member
10 months ago
Solved

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

  • 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

3 Replies

  • 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
    • Steeks91's avatar
      Steeks91
      New Member

      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. 

       


      Thanks MFelix !! 

      • MFelix's avatar
        MFelix
        Icon for Super User rankSuper User

        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:

         

        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.