Power BI write back, finally native: translytical task flows explained
Buttons in a Power BI report that update the database — translytical task flows pair Fabric user data functions with data function buttons and input slicers, so readers can write back without leaving the report.
Power BIFix a problem4 min read
For years, "can users update the data from the report?" ended every Power BI conversation with no, export to Excel. Translytical task flows change the answer: a button in the report calls a Fabric user data function, which writes to the source — annotations, status updates, approvals, discount changes, all without leaving the page.
The moving parts
Three pieces make a flow:
- A user data function in Fabric — your code (Python), with native connection management for Fabric SQL databases, warehouses and lakehouse files. Microsoft recommends a SQL database for most write-back, since it handles mixed read/write load well. The function must return a string — that string becomes the message the report shows.
- A data function button on the report page, its action type set to Data function, picking your function from the OneLake catalog.
- Input controls — slicers, selected rows or measures — bound to the function's parameters.
The semantic model can be DirectQuery (updates appear live), Direct Lake, or even Import — with Import the change lands in the source but waits for the next refresh to show.
Wire the button
- Add a button, open Action, set Type to Data function, and choose the function via the fx picker.
- Each function parameter appears below: bind one to a slicer on the page, another to a data field or measure (with a summarisation such as Maximum when rows aggregate).
- The button stays disabled until every parameter has input — clicking a table row or filling a slicer enables it, which doubles as your wiring test.
- Style the Loading state: data function buttons get an extra button state with a spinner, for text like "Submitting…" while the function runs.
- Optionally turn on Auto clear so input slicers empty themselves after a successful call.
Note
In Power BI Desktop you can configure everything but the button won't trigger until the report is published to the service — plan the first real test there.
Collect input with the input slicer
The input slicer (the renamed text slicer, now generally available) has two personalities: with a data column it filters; without one it's a pure input control — a text box whose value exists to be passed into your function. That's the pattern for comments, new values and annotations. A button slicer beside it covers pick-one choices such as a status.
- Reader selects a row and types a value
- The button enables
- The user data function validates and writes
- The report shows the function's message
Harden the function before anyone clicks
Microsoft's own best-practice list is the difference between a demo and something you'd let a department use:
Do
- Validate every parameter, and raise
fn.UserThrownError("…")for expected problems — the report shows your message instead of a stack trace. - Wrap database calls in try/except and return a friendly failure message for an unreachable source.
- Write parameterised SQL — a write-back button is an injection surface if you concatenate input.
- Return a clear success message; the reader sees exactly that string.
Beyond plain write-back, the same machinery powers status workflows with history and Teams notifications, and in-report alerts where notifications are just rows your function writes and the report displays. Microsoft ships tutorials for both.
Sources
Did this fix it?
Comments
No comments yet. Share what worked for you.
Sign in to comment. Comments show under a display name you choose, never your email.