Forum Discussion
Data function Button for running User Defined Function (UDF) is not configurable
I have created a User Defined Function button to writeback date from Power BI to a Fabric Warehouse. The UDF works when testing online and writes to the table and returns a string, but in PBI Desktop I cannot get the button to connect. I have all the preview items enabled that the documentation tells me to enable, and I've followed all the online documentation I could find, but my options still do not look like the options in online articles and other community posts.
When I select the fx options, it opens up a menu and I can select my UDF set or the specific UDF, but nothing changes and the button tooltip still says "The data function is not properly configured". What am I missing or doing wrong?
HI SamSantos,
You're not doing anything wrong β this is a known limitation and partial rollout issue with Power BI Desktop + Fabric Data Functions, This feature is NOT fully available in Power BI Desktop yet.
You can try enabling below options in power BI desktop
Power BI Desktop β Options β Preview
Data functions
Fabric Business Operations
Write-back
Direct Lake (if needed)
if it doesn't work, you can edit the UDF in Power BI service and test.
π I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
π‘ Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
π As a proud SuperUser and Microsoft Partner, weβre here to empower your data journey and the Power BI Community at large.
π Curious to explore more? [Discover here].
Letβs keep building smarter solutions together!Hi grazitti_sapna, thanks for this detail! Yes, when i published the workbook to my workspace and editted the report online, the Data Funciton options were made available to me. I did not realize that this was currently an online only function.
11 Replies
- grazitti_sapnaSuper User
HI SamSantos,
You're not doing anything wrong β this is a known limitation and partial rollout issue with Power BI Desktop + Fabric Data Functions, This feature is NOT fully available in Power BI Desktop yet.
You can try enabling below options in power BI desktop
Power BI Desktop β Options β Preview
Data functions
Fabric Business Operations
Write-back
Direct Lake (if needed)
if it doesn't work, you can edit the UDF in Power BI service and test.
π I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
π‘ Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
π As a proud SuperUser and Microsoft Partner, weβre here to empower your data journey and the Power BI Community at large.
π Curious to explore more? [Discover here].
Letβs keep building smarter solutions together!- SamSantosFrequent Visitor
Hi grazitti_sapna, thanks for this detail! Yes, when i published the workbook to my workspace and editted the report online, the Data Funciton options were made available to me. I did not realize that this was currently an online only function.
- Mauro89Super User
Hi SamSantos,
maybe its worse checking out the limitations of UDFs here. Just to varify if you have one of these applied.
If not I would consider checking the syntax of your UDF, as in my case in the beginning this was the issue. Here a code of mine which acutally works and then shows the fields/parameters in Power BI:
import fabric.functions as fn import uuid udf = fn.UserDataFunctions() # =============================== # UDF: update_defect_resolution # =============================== # Take a defect id, resolver, resoltuion notes and parts replaced (Status will be set automatically to "closed" as this is the intended action) as input parameters # Write the data back to the SQL database # Users will provide these parameters in the PowerBI report @udf.connection(argName="sqlDB",alias="DBSTOREDemo") @udf.function() def update_defect_resolution(sqlDB: fn.FabricSqlConnection, defectid: int, resolvedby: str, resolutionnotes: str, partsreplaced: str) -> str: """ Updates defect tracking record in the operational SQL database. Status is default set to "Closed" if a resolution is entered. Parameters: ----------- defectid : int Unique identifier of the defect record. resolvedby : str Name or ID of the maintenance worker. resolutionnotes : str Description of how the defect was resolved. partsreplaced : str Comma-separated list of parts replaced. Returns: -------- str "Defect resolution updated successfully." """ try: # Establish a connection to the SQL database connection = sqlDB.connect() cursor = connection.cursor() # Update query query = """ UPDATE [maintenance_demo].[defect_tracking] SET resolved_by = ?, resolution_notes = ?, parts_replaced = ?, status = 'Closed', resolution_timestamp = GETUTCDATE() WHERE defect_id = ? """ # Execute update cursor.execute(query, (resolvedby, resolutionnotes, partsreplaced, defectid)) # Commit the transaction connection.commit() cursor.close() connection.close() return "Defect resolution updated successfully." except Exception as e: return { "defect_id": defectid, "status": "Error", "message": str(e) }If this also does not help I recommend checking out the tutorial example as this have to work out anyway. If this also does not work I assume maybe some configuration is missing or it is indeed a issue somewhere in your environment and I recommend opening a issue to Microsoft to help you out.
You can submit a ticket via the Microsoft Power BI Support Portal:
How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
Best regards!
PS: If you find this post helpful consider leaving kudos or mark it as solution
- SamSantosFrequent Visitor
I appreciate the example, I'll give it a test. When you say you had syntax issues, do you mean you were able to get the UDF to run but not show in PBI and then had to change something? Or was the UDF not working until you changed some syntax and then connected it to PBI?
My UDF runs fine when testing online and I am getting records to write to the Fabric warehouse, but again, no options show in PBI Desktop for the Button Action. I've double and triple checked my PBI Preview options and have everything enabled. Plus. when I follow all the tutorials I've found online, I see that my Button Action options when I select Data Function are completely different than the examples. I'm wondering if this is a versioning issue.
- kushanNaSuper User
Hi SamSantos
did you click on the data function and then click Import?
I just followed the steps provided in this video and it works for me https://www.youtube.com/watch?v=voM47CcPa9s
- SamSantosFrequent Visitor
I did select Import but it didn't seem to do anything. The Button options I get are completely different than the linked video, i.e. no "Workspace", "Function Set", nor "Data Function" drop downs, only the (fx) button. Per grazitti_sapna response, it may just be due a recent change / rollout?