web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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.

I have the same question (0)
  • Verified answer
    AndrianaO Profile Picture
    213 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard