Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

ForAll calculation within Collection

(0) ShareShare
ReportReport
Posted on by 68
Hi, 
I have a collection that returns the transaction types based of a available options of a column using the distinct function (this is working).
But when I try to calculate the outstanding count, it returns the same value for all the different transaction types. Any idea what is not working in my formula?
 
ClearCollect(
    TransactionSummary,
    ForAll(
    Distinct(EmployeeTransactions,TransactionType.Value),
    {TransactionType: ThisRecord.Value,
    OutstandingCount: CountIf(
                EmployeeTransactions,
                Status.Value <> "Completed" && TransactionType.Value = ThisRecord.TransactionType.Value
            ),
            ProgressPercentage: RoundUp(
                (CountIf(
                    EmployeeTransactions,
                    Status.Value = "Completed" && TransactionType.Value = ThisRecord.TransactionType.Value
                ) / CountIf(
                    EmployeeTransactions,
                    TransactionType.Value = ThisRecord.TransactionType.Value
                )) * 100,
                0
            )
        }
    )
);

Are is the result I am getting: it returns the total outstanding count in my datasource and applies it to every row.

  • Verified answer
    AndrianaO Profile Picture
    187 Super User 2025 Season 1 on at
    ForAll calculation within Collection
    Hi, you can try this: 
     
    ClearCollect(
        TransactionSummary,
        ForAll(
        Distinct(EmployeeTransactions,TransactionType.Value) As distinctTransactions,
        {TransactionType: distinctTransactions.Value,
        OutstandingCount: CountIf(
                    EmployeeTransactions,
                    Status.Value <> "Completed" && TransactionType.Value = distinctTransactions.TransactionType.Value
                ),
                ProgressPercentage: RoundUp(
                    (CountIf(
                        EmployeeTransactions,
                        Status.Value = "Completed" && TransactionType.Value = distinctTransactions.TransactionType.Value
                    ) / CountIf(
                        EmployeeTransactions,
                        TransactionType.Value = distinctTransactions.TransactionType.Value
                    )) * 100,
                    0
                )
            }
        )
    );
     
    Let me know if it works! 

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1