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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Please Help! Calculati...
Power Apps
Unanswered

Please Help! Calculations not updating automatically in form that is embedded in Power BI

(0) ShareShare
ReportReport
Posted on by

Hello!

I've been trying to figure this out for quite sometime but I have not been able to fix the issue.

Apologies in advance for the long post

Background: creating a multi-form app that is embedded into a powerbi dashboard that has been published.

Sources: powerbi integration of several fields from an Opportunity table

  • multiple SharePoint lists - 1 per form

Powerbi interaction is used to select an Opportunity # in the dashboard which then shows the last entered data for the matching Opportunity # in the corresponding SP list within the embedded powerapp

Form with an issue: pricing form which has multiple data entry points (white) that then update calculated fields & totals (gray), automatically as the fields are updated (new forms & previously submitted forms

  • sample coding attached, I can add more if needed but there is a set() for each field & calculation on the OnVisible property of the screen as well as a set () on the OnChange property of the controls.

Issues:

  • main issue: while the fields automatically update correctly within make.powerapps.com, they do NOT updated automatically in the embedded app within the powerbi dashboard. Sometimes they update when Save a Draft or Submit buttons are selected but typically they do not. I've tried creating an "update calculations" button as a last resort but this does not update anything. Since the fields don't calcs & totals don't update properly, the data sent to SP is also incorrect when Submitted. The powerbi integration works properly so I have not been able to figure out why the interactions are different between the 2 different environments

  •  

  • secondary issue: the % entry fields do not always work properly. The data entry is being saved as a whole number to SP and is then supposed to be pulled back in at the whole # displayed in the field for previously submitted forms. The calculations were updated to calculate the whole number/100. Typically the initial entry works properly but then it will save to SP as say .15% instead of 15% so the updated calculations are way off

Attached: form layout & sample coding

Please help, I have lost countless days of productivity trying to correct this.

I have the same question (0)
  • Suggested answer
    VASANTH KUMAR BALMADI Profile Picture
    266 on at
    Please Help! Calculations not updating automatically in form that is embedded in Power BI
    Hi,

    It sounds like you've encountered a couple of complex issues with your PowerApps form embedded in Power BI, particularly related to how data updates and calculations are handled. Let's break this down step-by-step and try to identify potential solutions to address these issues.

    Issue Breakdown:

    1. Fields Not Updating Automatically in Embedded PowerApps (Power BI Integration)

    • Problem: The fields and calculations do not update automatically in the embedded PowerApp in Power BI, and changes typically reflect only when the Save a Draft or Submit buttons are clicked. This differs from the behavior seen when running the app in PowerApps Studio.

    • Potential Causes and Solutions:

      1. Delegation Limits/Performance Issues: PowerApps in Power BI can sometimes have performance issues or delegation limits when interacting with large data sources, causing delays in updates or incorrect calculations. However, since the Power BI integration is working properly and updates on button click, this might not be the issue.

      2. Context Variables Not Updating on Embedded App: It could be that the Set() function for your variables or controls is not refreshing or re-evaluating the formulas when the embedded app loads or the data changes. This can happen if you're relying on Set() in OnVisible or OnChange for dynamic updates but those variables aren't recalculated properly when the Power BI interaction occurs.

      • Fix: Ensure that you're explicitly refreshing or resetting the context variables when Power BI interaction happens. For example, on screen load (OnVisible), ensure that the calculations or updates to variables are triggered correctly:

        Set(YourVariable, YourCalculation);
        UpdateContext({YourContextVar: YourValue});

        You could also try using the Refresh() function to ensure that the SharePoint data and any other data sources are being updated and reloaded.

        Refresh(YourSharePointList);
      1. Power BI to Power Apps Context: There may be some syncing issues between Power BI and Power Apps in the embedded environment. When Power BI is embedded, some parameters might not pass the same way they do in Power Apps Studio, so the calculations or field updates might not trigger automatically. You can try explicitly using the PowerBIIntegration object to pass data or trigger updates based on the Power BI selection:

        Set(SelectedOpportunity, PowerBIIntegration.Data);

        Make sure that PowerBIIntegration is used properly to interact with the embedded Power BI data.

    2. Secondary Issue: % Entry Fields Not Saved Correctly

    • Problem: The percentage fields are being saved as whole numbers in SharePoint (e.g., 15% is saved as 0.15), and the calculations are being thrown off when it is retrieved back.

    • Potential Causes and Solutions:

      1. Saving Values in Incorrect Format: When you save the percentage to SharePoint, it's essential to correctly handle the transformation between a whole number and a percentage format.

      • Fix: Ensure that you're saving the percentage as a decimal (e.g., 15% as 0.15) by dividing by 100 when saving. For example, when submitting the form:

        Patch(YourSharePointList, YourRecord, {
        PercentageField: YourPercentageInput.Value / 100
        });
      1. Retrieving and Displaying Percentages: When retrieving the percentage back into PowerApps, you need to multiply it by 100 to display it as a whole number again for users to see the percentage.

        YourPercentageInput.Default = YourSharePointList.YourPercentageField * 100;

        This will display 15 as 15% in the input field (instead of 0.15).

      2. OnChange Formula to Update Calculations: If the percentage is involved in calculations, make sure that the calculations adjust accordingly. For example, if you're calculating totals based on percentage values, ensure the calculations correctly handle the percentage as a decimal value (i.e., 0.15 for 15%).

      Example for recalculating the total:

      Set(TotalAmount, SomeValue * (YourPercentageInput.Value / 100));

    General Recommendations to Troubleshoot and Improve:

    1. Check for Formula Errors: Use Error Checking (Alt + F9) in Power Apps to look for formula errors, which might be affecting field updates. Sometimes an overlooked error might cause the app to behave unexpectedly.

    2. Use UpdateContext() and Set() for Better Control: For automatic updates and calculations, use both UpdateContext() and Set() for local variables and global variables. This ensures that changes to one control will propagate across all related calculations and fields.

    3. Use the Timer Control for Periodic Updates: If needed, consider using a Timer control to trigger updates at regular intervals, especially if there are complex calculations that should be reevaluated periodically. For instance, set the OnTimerEnd property of the timer to trigger your calculations:

      Set(YourVariable, YourCalculation);
    4. Debugging in Power BI Embedded Mode: Consider embedding the PowerApp with more debugging options to get better insight into which part of the app is causing the issue. Use labels or logging to show values of variables and controls at runtime.

    5. Testing the Formula on Different Screens: Sometimes the issue could be related to the screen itself. Test the form by simplifying it and check if the calculations and updates work properly in isolation.


    Resources to Consult:

    1. Power Apps Performance Tips:
    2. Power BI and Power Apps Embedding:
    3. Power Apps Formula Syntax:
    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard