Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Distinct in If formula for gallery

(0) ShareShare
ReportReport
Posted on by 21

Hi, 

I have a gallery with report records on it but currently it is show up as multiple records. How do I show only distinct records?

 

Below is my formula: It looks at the input search text box for any data, if no data, show everything
If(IsBlank(SearchBox.Text),

SortByColumns('app.database',"cdr_date",SortOrder.Descending),

SortByColumns(Search('app.database',SearchBox.Text,"crew","cdr_ref","service_order","location"),"cdr_date",SortOrder.Descending)).

Secondly, I have another gallery which pulls in the report LxWxD data. How can i filter that gallery so when I select the distinct report in the first one, it will show all the rows of LxWxD data (for example if it has three rows of record for that)

 

Thanks!

 

Categories:
  • JayMagness Profile Picture
    JayMagness 1,663 on at
    Re: Distinct in If formula for gallery

    Please do not forget to close this and give the solution.

  • JayMagness Profile Picture
    JayMagness 1,663 on at
    Re: Distinct in If formula for gallery

    Hi,

    Yes there is the process I follow is to add lookups for the fields you want

  • weebot Profile Picture
    weebot 21 on at
    Re: Distinct in If formula for gallery

    Thanks all! Now I realized the distinct only bring in the one value - for example cdr_ref. Is there a way to bring in more such as crew, cdr_ref, service_order, location?

     

  • Verified answer
    Re: Distinct in If formula for gallery

    Hi @weebot ,

     

    In fact, you do not need if and isBlank to judge the SearchBox, and the first gallery can also be sorted by your given criteria. You can make some adjustments to Search statement by setting Items in the first gallery:

    Distinct(SortByColumns(
     Search(
     'app.database',
     SearchBox.Text,
     "crew",
     "cdr_ref",
     "service_order",
     "location"
     ),
     "cdr_date",
     SortOrder.Descending
    ),LxWxD)

     

    Then set the Items of the second gallery to:

    Filter('app.database',LxWxD=Gallery3.Selected.Value)

     

    Note: The name of our data source may be different, please use your data source name.

     

    Best regards,

    Rimmon Li

     

  • JayMagness Profile Picture
    JayMagness 1,663 on at
    Re: Distinct in If formula for gallery

    HI,

    If your formula above works to get the data, then you can do the following:

     

    Distinct( "Your formula" ),"The field to list")

     

    Distinct function in Power Apps - Power Platform | Microsoft Learn

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard