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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error with calculation...
Power Apps
Unanswered

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:
I have the same question (0)
  • Verified answer
    TheRobRush Profile Picture
    11,128 Moderator on at

    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)
  • punksterz626 Profile Picture
    on at

    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,128 Moderator on at

    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

    Reversing the order did the trick. Thank you!

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard