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 / ForAll not working for...
Power Apps
Answered

ForAll not working for a Lookup within the Loop

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

See the screenshot below.

I create a new Collection based on a ForAll.

First it finds the Maximum Version number.

Then it goes through and builds all the records (in this case 28) for that Version Number.

Note I am referring to Category_Index which is a number in the table from 1 to 28.

In colNew this Category_Index correctly gets built and is progressively number from 1 to 28.

However for Level_Index I look up the prior Quarters numbers.

This doesn't work because Category_Index for some reason doesn't change within the Lookup even though it changes in the colNew?

If I hand type in Category_Index as 1, 2, 3, 4 to 28 it works fine and pulls out the correct individual data?

Can anyone suggest what I am missing? Thanks in advance.

Capture.JPG

 

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I suspect that Category_Index in LookUp function was referring to its own Category_Index.

     

    Please try and use a As function:

    ForAll(
     Filter(...) As C,
     Collect(colNew,
     {...
     Level_Index:LookUp(
     ...
     And(Category_Index = Value(C.Category_Index),
     ...
     ),
     Level_Index
     )
     }
     )
    )
    

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you very much that worked like a charm!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard