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 / Compare and Sort/filte...
Power Apps
Answered

Compare and Sort/filter values in the gallery

(0) ShareShare
ReportReport
Posted on by 559

Hi All, 

I have a combo box(prjnames_3) which loads all the Projects from the SharePoint list. Below that I have a Practice label which loads when the value in the combo box is selected. It changes based on the Project selected. I have a gallery which sorts the Phases from a SharePoint list based on the Practice displayed.

This code gets the Practice from a list based on the Project names selected in the Combo box.

Set(varPractice ,LookUp(ProjectMaster_List,ProjectName = prjnames_3.Selected. Project Name, Practice.Value));

This code gets all the Phase names with respect to the Practice and compares with the varPractice where it is there above.

Clear(PracticeCollection);Collect(PracticeCollection, 'Practice Master');Clear(PhaseNameCollection);Collect(PhaseNameCollection,
Filter(Ungroup(ShowColumns(PracticeCollection,"Practice","PhaseName"),"PhaseName"),
!IsBlank(PracticeCollection)));
ForAll(
PhaseNameCollection,
If(
varPractice = Practice,
Collect(
Phasenames,
{id: Id,Phase: Value})));

All the above code is written on the On change property of the Combo box. so when Project is selected it will the get practice names which in turn gets the related Phase names and it must display the Phases values in the gallery.

 

The code on the items gallery is:

Distinct(Phasenames, Phase)

but the values in the gallery are not displaying properly based on the Practice instead displaying all the Phase values and filtering is not proper.

Any idea/suggestion on this.

Screenshot (78)_1.png
Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Uthhra ,

     

    The formulas that get phases OnChange of Combo box seem wrong. Please try below formulas instead:

    ClearCollect(PracticeCollection, 'Practice Master');
    ClearCollect(PhaseNameCollection,Ungroup(ShowColumns(PracticeCollection,"Practice","PhaseName"),"PhaseName"));
    ClearCollect(Phasenames,ForAll(PhaseNameCollection,If(varPractice = Practice,{id: Id,Phase: Value})));

     

    Best regards,

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 93 Most Valuable Professional

#2
Haque Profile Picture

Haque 81

#3
Valantis Profile Picture

Valantis 49

Last 30 days Overall leaderboard