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 / Replacing Distinct wit...
Power Apps
Answered

Replacing Distinct with GroupBY

(0) ShareShare
ReportReport
Posted on by 43

Hi,

I have a gallery displaying only the name and I would also want to display Organisation underneath. The Gallery can be filtered by 4 combo boxes and I tried to change the coding from Distinct to GroupBy, but I am not sure how I can integrate the drop downs with GroupBy or whether there is another solution to just add another label underneath Name that will display the Organisation name?

 

This is how the code looks atm:

 

Distinct(SortByColumns(Filter('WEF CRM',

StartsWith(
'Full Name',
TextInput3.Text
),
IsBlank(ComboBox1.SelectedItems.Value) || IsEmpty(ComboBox1.SelectedItems) || 'Stakeholder type'.Value= ComboBox1.Selected.Value,
IsBlank(ComboBox2.SelectedItems.Value) || IsEmpty(ComboBox2.SelectedItems) || Subtype.Value= ComboBox2.Selected.Value,
IsBlank(ComboBox2_1.SelectedItems.Value) || IsEmpty(ComboBox2_1.SelectedItems) || 'Best For'.Value= ComboBox2_1.Selected.Value
), "Title", If(SortDescending1, Descending, Ascending)), 'Full Name')

 

 

micha_a_1-1664190348210.png

 

 

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @micha_a,

    You mean you want to display the corresponding Organisation to the name?

     

    If so, I think GroupBy() is easier, 

    GroupBy(SortByColumns(Filter('WEF CRM',
    StartsWith(
    'Full Name',
    TextInput3.Text
    ),
    IsBlank(ComboBox1.SelectedItems.Value) || IsEmpty(ComboBox1.SelectedItems) || 'Stakeholder type'.Value= ComboBox1.Selected.Value,
    IsBlank(ComboBox2.SelectedItems.Value) || IsEmpty(ComboBox2.SelectedItems) || Subtype.Value= ComboBox2.Selected.Value,
    IsBlank(ComboBox2_1.SelectedItems.Value) || IsEmpty(ComboBox2_1.SelectedItems) || 'Best For'.Value= ComboBox2_1.Selected.Value
    ), "Title", If(SortDescending1, Descending, Ascending)), 'Full Name',"NameGroup")

    Inset a Label to display Organisation by settings its Text property as below:

    Concat(ThisItem.NameGroup,Organisation,",")
  • micha_a Profile Picture
    43 on at

    Hi @v-qiaqi-msft,

     

    Thank you for your reply, much appreciated.

     

    This is exactly what I tried with GroupBy, and unfortunately it returns this The function 'GroupBy' has some invalid arguments. I am not really sure what is wrong with the formula 

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @micha_a,

    Sorry for the mistake that you should refer to "Full Name" instead of the 'Full Name' in the GroupBy

    GroupBy(SortByColumns(Filter('WEF CRM',
    StartsWith(
    'Full Name',
    TextInput3.Text
    ),
    IsBlank(ComboBox1.SelectedItems.Value) || IsEmpty(ComboBox1.SelectedItems) || 'Stakeholder type'.Value= ComboBox1.Selected.Value,
    IsBlank(ComboBox2.SelectedItems.Value) || IsEmpty(ComboBox2.SelectedItems) || Subtype.Value= ComboBox2.Selected.Value,
    IsBlank(ComboBox2_1.SelectedItems.Value) || IsEmpty(ComboBox2_1.SelectedItems) || 'Best For'.Value= ComboBox2_1.Selected.Value
    ), "Title", If(SortDescending1, Descending, Ascending)), "Full Name","NameGroup")//Here you should use the double quotes""

     

  • micha_a Profile Picture
    43 on at

    Hi @v-qiaqi-msft ,

     

    I actually replaced the "Full Name" with "Title" and it worked! Thank you!

     

    The issues I am having now is that under Gallery 1 my name is duplicated as per the records in my list e.g. 4 records under my name, in Power Apps Gallery my name appears 4x as in the pic below . Distinct was doing the job for me and displaying the name only once,  but is there a way with GroupBy? Same duplication for Organisation (Test) - attached pic below 

    micha_a_1-1664275953079.png

     

     

     

    Thank you ever so much!

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard