web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps In PowerBI: ...
Power Apps
Suggested Answer

PowerApps In PowerBI: passing information from a source table to a writeback table, SQL source

(0) ShareShare
ReportReport
Posted on by 4
I have two tables in SQL Server: SourceTable and WritebackTable. This data displays in PowerBI. I want users to be able to select a row in the SourceTable and then enter data about that row in a new entry in WritebackTable. In order to do this, I need to pass information about the source row to the writeback table. How do I do this?
 
 
Example:
UserA is viewing the PBI report for ItemA. UserA wants to enter information that shows that ItemA has been reviewed for compliance. UserA will select ItemA and then click a drillthrough or a button and be taken to the tab that shows the form. The form will populate ItemA's ID and common name. UserA will then enter information into the form and save it to the writeback table. The writeback table is populated with information from the Sourcetable (ItemA's ID and common name, or even just the ID, that part doesn't matter), and the information that UserA entered about the item.
 
How do I make this work? I have seen information on making this work but none of those solutions work with SQL Server. Thank you for any help you can provide.
I have the same question (0)
  • Suggested answer
    SyedBilal Profile Picture
    18 on at

    Hey! The trick here is the Power Apps visual inside Power BI — that's the bridge between your selected row and the writeback table.

    The pattern in 4 steps:

    1. Add the Power Apps visual to your report. In Power BI Desktop, drop in the Power Apps visual (built-in).

    2. Drag the SourceTable fields you need into it. ItemID and CommonName at minimum. These become the "context" Power BI sends to your app.

    3. Create (or pick) the Power Apps form. Connect it to your SQL writeback table. Inside the app, the selected row's data is available as:

     First(PowerBIIntegration.Data).ItemID
    First(PowerBIIntegration.Data).CommonName
     

    Set your form's "ItemID" and "CommonName" labels to those — they'll auto-populate from whatever row the user clicked.

    4. Save with Patch(). Your save button writes everything (the passed-in ID + the user's input) to the writeback table:

     Patch(WritebackTable,
        Defaults(WritebackTable),
        {
            ItemID:        First(PowerBIIntegration.Data).ItemID,
            CommonName:    First(PowerBIIntegration.Data).CommonName,
            ReviewNotes:   txtNotes.Text,
            ReviewedBy:    User().Email,
            ReviewedOn:    Now()
        }
    )
     

    Two things that catch people out:

    • After saving, call PowerBIIntegration.Refresh() so the report reloads the writeback data.
    • The user runs the app under their own identity, so make sure they have insert permission on the SQL writeback table.

    No drillthrough page needed — the Power Apps visual lives on the same report tab, and as the user clicks rows, the data context updates automatically.

  • Suggested answer
    11manish Profile Picture
    2,589 on at
    For your use case:
    • Power BI + Embedded Power Apps + SQL Server is the simplest and most maintainable solution.
    • User selects a row in Power BI.
    • Power Apps automatically receives the selected ItemID and CommonName.
    • User enters compliance details.
    • Power Apps writes a new record to WritebackTable.
    • Power BI refreshes and displays the updated information.
    This pattern works very well with SQL Server and is widely used for compliance tracking, approvals, comments, forecasting adjustments, and other writeback scenarios.
  • CU02061629-0 Profile Picture
    4 on at
    @SyedBilal Thank you for those steps! What has worked so far from your input: 
    1) Instead of bringing in both of the matching fields from the sourcetable and writeback table, I only bring in the one from the sourcetable. This temporarily worked and allowed me to writeback the row.
     
    However, it did that while the form itself didn't show any data and only showed the Save button. The form itself says "Getting your data" and will not change to anything else. Earlier on in my testing, I was able to have it successfully display the form, but it has not worked in several days, ever since I tried tying the source table into the writeback data. 
     
    Too, the page that displays the data is too cluttered to add a PowerApps form to it. For the sake of testing, I created a table that had only the fields I am trying to pass and then created the form. This gave me the most success; however, I still can't actually see the form.
     
    Third, when you write "After saving, call PowerBIIntegration.Refresh() so the report reloads the writeback data.", Where do I call this?
     
    Fourth, I apologize for creating another top level comment to reply to you, but I am new to using this platform and do not see where a Reply button is available.
  • Suggested answer
    SyedBilal Profile Picture
    18 on at

    @CU02061629-0 No worries about the reply structure — many people hit that on this platform. Glad it partially worked! Let's clear up the remaining issues.

    The "Getting your data" issue:

    That message usually means the form is stuck waiting for data that isn't coming through. Set the form up explicitly for a new entry:

    • Form DataSource = WritebackTable
    • Form DefaultMode = FormMode.New
    • Form Item = Defaults(WritebackTable)

    Then in each data card, set the Default property to pull from the Power BI visual:

    • ItemID card Default = First(PowerBIIntegration.Data).ItemID
    • CommonName card Default = First(PowerBIIntegration.Data).CommonName

    That will get the form rendering immediately and pre-populating with the row the user selected.

    Where to call PowerBIIntegration.Refresh():

    It goes in the OnSelect of your Save button, right after the Patch. Your Save button OnSelect should look like this:

    Patch(WritebackTable, Defaults(WritebackTable), { ItemID: First(PowerBIIntegration.Data).ItemID, CommonName: First(PowerBIIntegration.Data).CommonName, ReviewNotes: txtNotes.Text, ReviewedBy: User().Email, ReviewedOn: Now() });
    PowerBIIntegration.Refresh()

    The semicolon chains them so Power BI refreshes right after the save.

    The cluttered page issue:

    You don't need the form on the same page as your main report. The cleanest setup is:

    • Create a new page in the report and call it Writeback or Review
    • Put only the Power Apps visual on that page
    • Right-click your SourceTable visual on the main page and configure a Drillthrough that takes users to the Writeback page filtered by the row they clicked

    This keeps your main report tidy and gives the form room to render properly.

    Quick sanity check: if the form still says "Getting your data" after those changes, edit the Power Apps visual, sign in, and check the Data panel on the Studio side. A stale or broken connection to WritebackTable often produces that exact symptom.

    Try those and let me know what you see — happy to keep iterating.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 421

#2
Valantis Profile Picture

Valantis 405

#3
timl Profile Picture

timl 337 Super User 2026 Season 1

Last 30 days Overall leaderboard