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

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.

SamSantos_0-1764800715655.png

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?

SamSantos_1-1764800788584.png

 

2 ACCEPTED SOLUTIONS
grazitti_sapna
Super User
Super 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!

View solution in original post

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. 

View solution in original post

10 REPLIES 10
kushanNa
Super User
Super 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 

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?

Hi @SamSantos 

 

Yes there's a change in the properties from the tutorial , but everything works fine for me in the desktop , DB is getting updated as well 

 

kushanNa_0-1764871651768.png

 

 

 

Mauro89
Power Participant
Power Participant

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

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.

SamSantos_1-1764865932736.png

SamSantos_2-1764865966240.png

 

 

@SamSantos in my case the UDF showed up in Desktop but was not executing properly when used. That was due to syntax issues, eventhough the "testing" function of the UDF was saying everything is fine configured.

I see. Thanks @Mauro89, not only did I need to switch to editting the report online as @grazitti_sapna mentioned, it also looks like PBI did not like me trying to pass a date through. I had to change to only Strings and Integers and then PBI to allow me to connect to the Data Function in my Function Set.

Awesome if @grazitti_sapna and myself brought you to the solution 👍🏻

grazitti_sapna
Super User
Super 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!

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. 

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.