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 / Combining Distinct and...
Power Apps
Answered

Combining Distinct and Filter with ForAll in a gallery

(0) ShareShare
ReportReport
Posted on by 43

Hi everyone,

 

I'm struggling with the following problem:
I have a table which looks like this:

ID

NameValueStatus
1Blue75Success
2Green22Fail
3Red12Success
3Red20Success
3Red16Success

 

In my gallery, I'm using the following code on the Items property to get a list of names of the distinct ID's:

 

ForAll(
Distinct(DataSource, ID),
LookUp(DataSource, ID= Result)
)

 

This results in a gallery as such:

 

1Blue
2Green
3Red

 

However, I would like to also filter this gallery on the Status column, only displaying the records that have the Status 'success'.

How do I combine a Filter statement with my code above?

Thank you in advance!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @PA-JvdP ,

    As below with a bonus column adding up the Value column

    AddColumns(
     GroupBy(
     Filter(
     'Order pdf AI outputs',
     Status = "Success"
     ),
     "principalsOrderNumber",
     "Data"
     ),
     "Items",
     CountRows(Data),
     "Total",
     Sum(Data,Value)
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • PA-JvdP Profile Picture
    43 on at

    Unfortunately, this leads to other problems. On the OnSelect property of the navigation icon in my gallery, I have this formula:

    Set(varGetDocument, PowerAutomateName.Run(Gallery.Selected.SharePointIdentifier).result)

     

    However, in this formula I get the error "Name isn't valid. 'SharePointIdentifier' isn't recognized."

    I'm guessing this is because the SharePointIdentifier column wasn't given in the Items formula you suggested. I tried adding it as another AddColumns argument:

    "SharePointIdentifier",
    Data.SharePointIdentifier

    But this gives me another error: "Invalid argument type (Table). Expecting a Text value instead.".

    How can I insert the SharePointIdentifier to the grouped data as a column? 

  • Verified answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    @PA-JvdP ,

    You can use

    AddColumns(
     GroupBy(
     Filter(
     'Order pdf AI outputs',
     Status = "Success"
     ),
     "principalsOrderNumber",
     "Data"
     ),
     "Items",
     CountRows(Data),
     "Total",
     Sum(Data,Value),
     "SharePointIdentifier",
     First(Data).SharePointIdentifier
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard