Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Filter in a gallery with 2 sharepoint lists

Posted on 27 Nov 2024 11:13:57 by 679
I have a gallery on my Power Apps screen that displays all the items coming from my sharepoint list "List 1". And in this gallery, there is a label for which I wrote this formula :  Last(Filter(List2; Immatriculation.Value = ThisItem.Immatriculation)).KilomĂ©trage   This formula allows me to retrieve the last KilomĂ©trage of an item in the List2 list based on the Immatriculation search column. 
I would like to filter my gallery to display only the items in List1 based on whether their last Kilométrage value is greater than 20000.
Kilométrage is a number column in List2
Immatriculation is a text column in List1, and it is a search column in List2
 
Can you help me please ? I tried this but it's doesn't work : 
 
Filter(
    List1;
    Value(
        Last(
            Filter(List2; Immatriculation.Id = Immatriculation.Id)
        ).KilomĂ©trage
    ) > 20000
)

 
  • mmbr1606 Profile Picture
    mmbr1606 9,884 on 27 Nov 2024 at 13:09:29
    Filter in a gallery with 2 sharepoint lists
    hey
     
     
    its not the same because the new code has .Value in it.
     
    Filter(
        List1,
        Value(
            Last(
                Filter(
                    List2, 
                    Immatriculation = ThisItem.Immatriculation.Value 
            ).Kilométrage
        ) > 20000
    )
    cheers
  • s44 Profile Picture
    s44 679 on 27 Nov 2024 at 12:58:01
    Filter in a gallery with 2 sharepoint lists
    mmbr1606   You sent me the exact same code. I don't understand how to adapt the structure, I can't do it. Can you help me please?
  • Suggested answer
    mmbr1606 Profile Picture
    mmbr1606 9,884 on 27 Nov 2024 at 12:46:31
    Filter in a gallery with 2 sharepoint lists
    thanks for giving details about column types
     
     
    can u try this:
    Filter(
        List1,
        Value(
            Last(
                Filter(
                    List2, 
                    Immatriculation = ThisItem.Immatriculation.Value  // Adjust this according to your field structure
                )
            ).Kilométrage
        ) > 20000
    )
    
     
  • s44 Profile Picture
    s44 679 on 27 Nov 2024 at 11:58:30
    Filter in a gallery with 2 sharepoint lists
    It's doen't work :(
     
    I have this errors : Types incompatibles pour la comparaison. Il est possible de comparer ces types : Record, Error.
    Le nom n’est pas valide. « ThisItem Â» n’est pas reconnu.
    L’opĂ©rateur « . Â» ne peut pas ĂŞtre utilisĂ© sur les valeurs Error.
     
    Kilométrage is a number column in List2
    Immatriculation is a text column in List1, and it is a search column in List2
  • Suggested answer
    mmbr1606 Profile Picture
    mmbr1606 9,884 on 27 Nov 2024 at 11:52:07
    Filter in a gallery with 2 sharepoint lists
    hey 
     
     
    thanks for trying, can u try this modification:
    Filter(
        List1,
        Value(
            Last(
                Filter(
                    List2, 
                    Immatriculation = ThisItem.Immatriculation
                )
            ).Kilométrage
        ) > 20000
    )
    
    if its also not working please let us know which column types you are using here
     
     
    if it worked please mark as verified answer,
     
     
    cheers
  • s44 Profile Picture
    s44 679 on 27 Nov 2024 at 11:44:49
    Filter in a gallery with 2 sharepoint lists
    I have this error with your formula  : Types incompatibles pour la comparaison. Il est possible de comparer ces types : Text, Error.
    And ThisItem is not recognized
  • mmbr1606 Profile Picture
    mmbr1606 9,884 on 27 Nov 2024 at 11:20:39
    Filter in a gallery with 2 sharepoint lists
    hey
     
     
    can u try this:
    Filter(
        List1,
        Value(
            Last(
                Filter(
                    List2, 
                    Immatriculation.Value = ThisItem.Immatriculation
                )
            ).Kilométrage
        ) > 20000
    )
    
    you might need to rename to your needs

    if it worked please mark as verified answer,
     
     
     
    cheers

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,137

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,813

Leaderboard