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 / Filter Gallery Using t...
Power Apps
Answered

Filter Gallery Using the field of the same gallery

(0) ShareShare
ReportReport
Posted on by 145

Hi, 

I have a Screen which is divided into 2 parts which are: 

  1. A gallery with data source QUOTE LINE DETAIL (Common Data Service) which is filtered on the basis of a text field from another form.
  2. Edit Form with data source QUOTE LINE (Common Data Service), which contains a text field.

The filter which I have used is:

Filter('Quote Line Detail', 'Quote Line'.Name= WriteInProductTEXT.Text)

Now, the gallery is filtering but there are some duplicate records twice and i don't want duplicate records.

I want to filter those records on the basis of a field which is there in the Gallery.

 

I need help in this as I am not able to filter this and I have an urgent requirement to complete this and I am also new to PowerApps.

 

Any help will be appreciated.

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @tjalui 

    There must be duplicate records in your Quote Line table.  How can you tell if something is duplicate?  What's the rule?

     

    Please let me know and share a screenshot.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @tjalui ,

    Could you please share a bit more about the "Quote Line" column in your 'Quote Line Detail' Entity? Is it a LookUp column?

    Are there some duplicated records existed in your 'Quote Line Detail' Entity? Or single one "Quote Line' Entity record could match multiple 'Quote Line Detail' Entity records?

     

    If the single one "Quote Line' Entity record could match multiple 'Quote Line Detail' Entity records (one-to-many relationship), I think the issue that you mentioned is an normal behavior.

    Note: Please compare the record id of these duplicated records, if they are not the same, it means that these records are all separated records rather than same record.

     

    If you want to remove the duplicated records in your Gallery, I think the GroupBy function could achieve your needs. Please consider set the Items property of the Gallery to following:

    GroupBy(
     Filter('Quote Line Detail', 'Quote Line'.Name = WriteInProductTEXT.Text),
     "Primary Column", // 'Primary Column' represents the column name you want to display as distinct in your Gallery
     "GroupData"
    )

    If you want to review these data under the grouped data, please consider add a nested Gallery within the parent Gallery, set the Items property of the nested Gallery to following:

    ThisItem.GroupData

     within this nested Gallery, you could add several Labels to display the corresponding column value.

     

  • tjalui Profile Picture
    145 on at

    Hi @v-xida-msft ,

     

    I have tried your approach this is the formula that i have used in the 1st gallery

    GroupBy(
     Filter(
     'Quote Line Detail',
     'Quote Line'.Name = WriteInProductTEXT.Text
     ),
     "msdyn_transactiontypecode",
     "GroupData"
    )

     but I am not able to set the Items property of the nested Gallery

    Community_1.png

    Please do help me.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @tjalui ,

    Please make sure the nested Gallery (second Gallery) is added within the 1st Gallery rather than outside the 1st Gallery.

     

    According to the screenshot that you mentioned, I could not see the nested Gallery, and the GalleryQuoteLineDetail is in Top Level rather than acted as nested control within another control.

     

    More details about adding a nested Gallery in PowerApps, please check the following video:

    https://www.youtube.com/watch?v=ZzQ1t2sQvj8

     

    Best regards,

  • tjalui Profile Picture
    145 on at

    Hi @v-xida-msft,

     

    Thanks for the help, but its not working.

  • tjalui Profile Picture
    145 on at

    Hi @mdevaney ,

    I have two filters

    This filter filters the gallery based on a record selected on the previous gallery 

    Filter(
     'Quote Line Detail',
     'Quote Line'.Name = GalleryQuoteLine.Selected.'Quote Line Description'
     )

    This is the output of the 1st filter:

    Community_5_1.png

    Here i am getting duplicate records as there are duplicate records in the CDS, so I want to filter this on the basis of Transaction type field on the gallery. This is the filter I am using:

    Filter(
     'Quote Line Detail',
     'Transaction Type' in "Project Contract"
     )

    If I use this individually then this is the output:

    Community_5_2.png

    I want both the filter to work together but when i use both the filter together it is not working.

    The filter I am using:

    SortByColumns(
     Filter(
     'Quote Line Detail', 'Quote Line'.Name= GalleryQuoteLine.Selected.'Quote Line Description' &&
     'Transaction Type' in "Project Contract"
     ),
     "createdon",
     Ascending
    )

     The gallery doesn't shows any records.

     

    Please do help. 

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @tjalui ,

    Could you please share a bit more about the 'Transaction Type' column in your 'Quote Line Detail' Entity? Is it a Option Set column?

     

    If the 'Transaction Type' column in your 'Quote Line Detail' Entity is a Option Set type column, please consider modify your formula as below:

     

    SortByColumns(
     Filter(
     'Quote Line Detail', 'Quote Line'.Name= GalleryQuoteLine.Selected.'Quote Line Description',
     'Transaction Type' = [@'Transaction Type'].'Project Contract'
     ),
     "createdon",
     Ascending
    )

     

     

    If the 'Transaction Type' column in your 'Quote Line Detail' Entity is a "Two Options" type column, please consider modify above formula as below:

     

    SortByColumns(
     Filter(
     'Quote Line Detail', 'Quote Line'.Name= GalleryQuoteLine.Selected.'Quote Line Description',
     'Transaction Type' = 'Transaction Type (Quote Line Detail)'.'Project Contract'
     ),
     "createdon",
     Ascending
    )

     

     

    If the 'Transaction Type' column in your 'Quote Line Detail' Entity is a normal Text type column, modify your formula as below:

     

    SortByColumns(
     Filter(
     'Quote Line Detail', 'Quote Line'.Name= GalleryQuoteLine.Selected.'Quote Line Description',
     "Project Contract" in 'Transaction Type' // Modify formula here
     ),
     "createdon",
     Ascending
    )

     

    Please consider take a try with above solution, check if the issue is solved.

     

    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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 426

#2
WarrenBelz Profile Picture

WarrenBelz 381 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard