I have written a Power App that has been embedded on Power BI report page.
Since it is much easier to develop Power App with browser than in Power BI Desktop, I have built the app like this:
- In App OnStart, the App only creates couple of constants that never change (when you use Power App from BI report, it doesn't read App's OnStart)
- App starts up with a page that has only an invisible timer of 0.001 second.
- This timer runs code
If( IsBlankOrError(varProjectID), Set( varProjectID, First([@PowerBIIntegration].Data).ProjectID ));
If( IsBlankOrError(varProjectID), Set( varProjectID, "PApps test case" ));
If( IsBlank(First(Filter('PATool.ProjectEscalation', ProjectID = varProjectID )).ProjectID), Set(varNewData,true), true, Set(varNewData,false));
If( varNewData, Patch( 'PATool.ProjectEscalation', Defaults('PATool.ProjectEscalation'), varBlankRecord ));
If(
Not(IsEmpty(Errors('PATool.ProjectEscalation'))),
Notify(
"_" & First(Errors('PATool.ProjectEscalation')).Message,
NotificationType.Error
)
);
After that it goes to web form that has
DataSource: 'PATool.ProjectEscalation'
Item: First(Filter('PATool.ProjectEscalation', ProjectID = varProjectID ))
When I develop and test the App it works correctly by changing the DEV data with hard-coded key.
I have simplified this a bit, such as didn't include varBlankRecord creation code.
When I test with Power BI Desktop version 2022/12 or 2013/02 (as 2013/01 has App connector bug) the App works correctly: it reads the key correctly from Power BI and changes the production data.
When other people test the report on service they get varying results probably based on what has been done before that use by someone else:
- Three out of four got testing data (I believe they used this after my development)
- One out of three got production data, but with an error message "Error when trying to retrieve data from network"
- The app works perfectly to everyone after the first use during that active session, but I have also got an error message occasionally when developing and testing, so it is not strictly only the first use that fails.
- They need to approve database connection
I have tested the timer with three seconds also, but with the same result.
Why does the first App use from Power BI fail to use production data properly?

Report
All responses (
Answers (