Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Error with calculation when navigate button is used

(0) ShareShare
ReportReport
Posted on by

So i have a text label with the following formula to tally up employee count when an employee is selected

 

text label syntax "Approved" & " " & "|" & " " & CountIf('Org Chart', 'Reporting Manager'= mgrVar)

 

Set(mgrVar, ThisItem.Employee)

 

This works great when used in a hierarchy format, meaning moving from screen1 (manager) > screen2(supervisor) >screen3(reporting employee)

 

However, when I use a button that navigate back to the previous screen, the results doesnt change and instead stay the same as the last page it was on. I understand why because it was the last employee selected. Is there a way to dynamically change it to the previous employee?

 

Ex.  if screen1 (Manager "A" has 6 supervisors reporting to him and I click on one of his supervisor (which goes to screen2, who has 10 employees reporting to him), then I click the back button(screen1) I want the information to reflect Manager "A" data which is 6. At the moment it is 10 because it was the last record selected. 

 

I hope this make sense. 

Categories:
  • punksterz626 Profile Picture
    on at
    Re: Error with calculation when navigate button is used

    Reversing the order did the trick. Thank you!

  • Verified answer
    TheRobRush Profile Picture
    11,121 Super User 2025 Season 1 on at
    Re: Error with calculation when navigate button is used

    on the /next/ page put a label that says prevMgrVar and if needed a .FullName or whatever variable you wanna check, and see what it is beign set to

     

    might also try reversing the Next Arrow to

    Set(prevMgrVar, mgrVar);
    Set(mgrVar, ThisItem.Employee);
    Navigate(HomeScreen3)
  • punksterz626 Profile Picture
    on at
    Re: Error with calculation when navigate button is used

    It is not yielding the result.

     

    So on the Next Arrow button Onselect i have the following syntax

    Navigate(HomeScreen3) && Set(mgrVar, ThisItem.Employee) && Set(prevMgrVar, mgrVar)

     

    On the text label I have

    "Approved Headcount" & " " & "|" & " " & CountIf('Org Chart', 'Reporting Manager'= mgrVar)

     

    On the back button Onselect i have this

    Set(mgrVar,prevMgrVar) && Back()

     

     

  • Verified answer
    TheRobRush Profile Picture
    11,121 Super User 2025 Season 1 on at
    Re: Error with calculation when navigate button is used

    the same way we did the Set(mgrVar, ThisItem.Employee) to set a mgrvar on going forward, in that same button, before you call this formula, add a save of the old liek so

    Set(prevMgrVar, mgrVar)
    Set(mgrVar, ThisItem.Employee)

    then on your back button, right before you call the Back() place this

    Set(mgrVar, prevMgrVar)

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1