Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I’m working on a Translytical Task Flow, first i have followed this link ((https://learn.microsoft.com/en-us/power-bi/create-reports/translytical-task-flow-tutorial)) everthing went well so i have thought to implement few more operations in the Microsoft’s sample code as a base implemented create, edit, and delete functionality and pasted in the User Data Function, . Here’s the situation: Delete function is working as expected. When I create a record: It does not appear in the report. But when I run a SQL query in the backend, I can see that the record is created, though it’s showing with a different name. For Edit function: It was working earlier. However, after adding the create and delete logic, the edit function stopped working and i have run the User data fucntion it is working. Everthing i have done in service only.
Report Setup Details: I used one table with 3 columns. Added a blank button and set its action to User Data Function. Here i have created a Action column with same name as create,delete,edit and given that action to the blank button becasue when user select the slicer as one action like create , delete , edit, the system should understand which action to perform. Mapped the fields accordingly and added a text slicer to pass user input.
Has anyone faced a similar issue? Am I missing something in how the state is updated for the report to reflect the changes from create/edit?
Can you please give me step by step details about report also how to apply this operations in report like if i want to edit i have select the record in table and added my text in text slicer then clicked on Submit. is this how i have to follow? just i am verfiying am i doing everthing correct or not.
Sample Code where i have modified the microsoft sample code:
Solved! Go to Solution.
Hi @Mohan128256,
Thanks for the update and follow-up question.
It sounds like your SQL logic is fine, but the issue is with how inputs are passed from the report to your User Data Function. Since all values are typed together (like 1,test1,test2…), Power BI can’t identify which value belongs to which parameter, so it’s mapping them randomly. Please try this below I mentioned:
Create separate text inputs for each field PageNo, ReportName, PageName, ReportDescription, and ReportLink. Go to your Submit button → Format → Action → User Data Function, and make sure each parameter is mapped to the correct input visual. For optional Add a message box to show the success message after submission. After mapping them separately, the record should be created with correct values.
Hope this clarifies it. Let us know if you have any doubts regarding this. We will be happy to help.
Thank you for using the Microsoft Fabric Community Forum.
Hi @v-kpoloju-msft
The records are updating but i want to create a record in report. I have Pageno,ReportName,PageName,ReportDescription,ReportLink . Whenever i click on created description only updating remaning values are taking randamly and if i type 1,test1,test2.. in text Slicer how the system know that pageno is 1, report name is test1. Can you please give any suggestions. End of the Output i want it like Pageno,reportname,pagename,reportdescription,reportlink values if type in serach slicer and clicked on created record. The record should be updated. it should not take random values.
Hi @Mohan128256,
Thanks for the update and follow-up question.
It sounds like your SQL logic is fine, but the issue is with how inputs are passed from the report to your User Data Function. Since all values are typed together (like 1,test1,test2…), Power BI can’t identify which value belongs to which parameter, so it’s mapping them randomly. Please try this below I mentioned:
Create separate text inputs for each field PageNo, ReportName, PageName, ReportDescription, and ReportLink. Go to your Submit button → Format → Action → User Data Function, and make sure each parameter is mapped to the correct input visual. For optional Add a message box to show the success message after submission. After mapping them separately, the record should be created with correct values.
Hope this clarifies it. Let us know if you have any doubts regarding this. We will be happy to help.
Thank you for using the Microsoft Fabric Community Forum.
Hi @Mohan128256,
Just checking in to see if the issue has been resolved on your end. If the earlier suggestions helped, that’s great to hear! And if you’re still facing challenges, feel free to share more details happy to assist further.
Thank you.
Hi @Mohan128256,
Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to @BeaBF, for his inputs on this thread. And detailed explanation and for sharing your modified function that helps a lot.
From what you described, your backend logic for create/update/delete is working correctly (since you can verify the SQL table changes). However, the issue is that Power BI visuals don’t automatically refresh after a create or update operation only after a delete.
Here is what you can do to fix this: Make sure your dataset is using DirectQuery mode, not Import. Edit your button → Add a “Refresh visuals” action under Format → Action → + Add action. Set it to trigger after the User Data Function completes successfully. Double-check that your input fields (especially ReportName and PageName) are correctly mapped to the function parameters.
Once done, your new and edited records should appear in the report right after you click Submit.
Hope this helps. Let us know if you have any doubts regarding this. We will be happy to help.
Thank you for using the Microsoft Fabric Community Forum.
Hi @Mohan128256,
Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to @BeaBF, for his inputs on this thread.
Has your issue been resolved? If the response provided by the community member @BeaBF, addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Community Forum.
Hi @v-kpoloju-msft ,
Right my only concern is that sometimes the Create and Delete buttons are not working.
i have tried above code but in update part i am facing issue so i create 2 UDFs like Create and Delete and added in Blank button and given actions as UDF which i created. at the starting it is working fine but all of sudden it is not working
@Mohan128256 Hi!
Let’s build a slightly more robust version of your UDF that does three things differently:
Standardizes the ReportName so that create and update/delete won’t mismatch due to spaces/casing.
Returns the affected row(s) after each operation so you can display them in a card/table visual in the report.
Adds debug feedback in case an update/delete affects 0 rows (so you’ll know immediately if it’s a key mismatch).
import fabric.functions as fn
udf = fn.UserDataFunctions()
@udf.connection(argName="sqlDB", alias="DemoSQLDBPOC")
@udf.function()
def manage_report(sqlDB: fn.FabricSqlConnection,
operation: str, # "create", "update", "delete"
ReportName: str = None,
PageName: str = None,
ReportDescription: str = None,
Keywords: str = None,
ReportLink: str = None):
# Error handling for report description length
if ReportDescription and len(ReportDescription) > 200:
raise fn.UserThrownError(
"Descriptions have a 200 character limit. Please shorten your description.",
{"Description": ReportDescription}
)
# Normalize ReportName for consistency
if ReportName:
ReportName = ReportName.strip().lower()
connection = sqlDB.connect()
cursor = connection.cursor()
result_msg = ""
# CREATE
if operation.lower() == "create":
insert_query = """
INSERT INTO ReportCatalog (ReportName, PageName, ReportDescription, Keywords, ReportLink)
VALUES (?, ?, ?, ?, ?)
"""
cursor.execute(insert_query, (ReportName, PageName, ReportDescription, Keywords, ReportLink))
connection.commit()
result_msg = "Report record was created successfully."
# UPDATE
elif operation.lower() == "update":
update_query = """
UPDATE ReportCatalog
SET PageName = ?, ReportDescription = ?, Keywords = ?, ReportLink = ?
WHERE LOWER(LTRIM(RTRIM(ReportName))) = ?
"""
cursor.execute(update_query, (PageName, ReportDescription, Keywords, ReportLink, ReportName))
connection.commit()
if cursor.rowcount == 0:
result_msg = f"No record found with ReportName = {ReportName}."
else:
result_msg = "Report record was updated successfully."
# DELETE
elif operation.lower() == "delete":
delete_query = "DELETE FROM ReportCatalog WHERE LOWER(LTRIM(RTRIM(ReportName))) = ?"
cursor.execute(delete_query, (ReportName,))
connection.commit()
if cursor.rowcount == 0:
result_msg = f"No record found to delete with ReportName = {ReportName}."
else:
result_msg = "Report record was deleted successfully."
else:
raise fn.UserThrownError(
"Invalid operation. Please specify 'create', 'update', or 'delete'.",
{"operation": operation}
)
# Fetch and return the latest state for that ReportName (if not deleted)
return_data = []
if operation.lower() != "delete":
cursor.execute("SELECT * FROM ReportCatalog WHERE LOWER(LTRIM(RTRIM(ReportName))) = ?", (ReportName,))
rows = cursor.fetchall()
return_data = [dict(zip([desc[0] for desc in cursor.description], row)) for row in rows]
cursor.close()
connection.close()
return {
"message": result_msg,
"data": return_data
}
Bind your button action (Submit button) to this UDF.
After running, the UDF now returns:
message: a status string (create/update/delete success or error).
data: the row(s) that were just created/updated.
In Power BI, bind message to a card visual for user feedback.
Bind data to a table visual to instantly reflect what was changed, without waiting for dataset refresh.
BBF
Hi @BeaBF ,
Thanks for the response i have tried this in update section i am getting errors, so i have created UDF for Create and Delete so it is working fine but suddenly it stopped working like it is showing a promt as record deleted or created but in the report it is not reflection sometime.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 54 | |
| 18 | |
| 11 | |
| 11 | |
| 9 |