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 calculation wit...
Power Apps
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
    242 Moderator on at
    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

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 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard