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 / Pull matching values o...
Power Apps
Answered

Pull matching values of the records in SP list

(0) ShareShare
ReportReport
Posted on by 144

ClearCollect(

CollectionCode,

ForAll(

Distinct(

Filter(

CollectionA),Group),

Lookup(ListA,

columnA = Value

).columnB));

 

 

The above formula fetchs only one record that matches the criteia. But need to pull all the records that matches the value.

THanks.

Categories:
  • SpongYe Profile Picture
    5,909 Super User 2026 Season 2 on at

    Hi @HarishaAkkil 

     

    try this:

    ClearCollect(
     CollectionCode,
     ForAll(
     Distinct(Filter(CollectionA),Group),
     Filter(ListA, columnA = Value).columnB // Changed to Filter
     )
    );

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • realwillwright Profile Picture
    772 Moderator on at

    Hi @HarishaAkkil 

     

    From what I can tell of the code, you are trying to create a collection of values columnB. Doing this by filtering CollectionA and getting all unique values of the column 'Group' then doing a lookup on ListA, where columnA equals the unique value 'Group'. 

     

    How many distinct values of Group are there?

     

    ClearCollect(
     CollectionCode,
     ForAll(
     Distinct(
     Filter(
     CollectionA,
     1=1
     ),
     Group
     ),
     Lookup(
     ListA,
     columnA = Value
     ).columnB
     )
    );
  • HarishaAkkil Profile Picture
    144 on at

    Hi @SpongYe ,

    Getting error saying incompatiable type. The collection can't contain this value.

    Please help.

    Thanks.

  • SpongYe Profile Picture
    5,909 Super User 2026 Season 2 on at

    Hi @HarishaAkkil 

     

    Change the order of the Forall en Collect so you can loop through the items and collect the record into the collection. 

    ForAll(
     Distinct(CollectionA, Group),
     Collect(
     CollectionCode,
     LookUp(ListA, columnA = ThisRecord.Value).columnB
     )
    )

     If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • HarishaAkkil Profile Picture
    144 on at

    No doesn't work as expected, resulting the same output.

  • Verified answer
    realwillwright Profile Picture
    772 Moderator on at

    @HarishaAkkil 

     

    it looks like the collection is outside of the forall, I've moved the collection around and removed the distinct. The distinct can be added back in if required.

     

    Clear(CollectionCode);
    ForAll(
     Filter(
     collectionA,
     1=1
     ) As dataLoad,
     Collect(
     CollectionCode,
     LookUp(
     ListA,
     dataLoad.<columnname> = columnA
     ).columnB
     )
    );



    -------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • HarishaAkkil Profile Picture
    144 on at

    Using Lookup fetches only one data that matches in the List A, But List A has many records that has same name as DataLoad. Is there any other way to rewrite it by avoid using LookUp?

  • HarishaAkkil Profile Picture
    144 on at

    Hi @realwillwright ,

    Instead of Lookup I used Filter. It did worked. Thank you so much. You are really great.

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard