web
You’re offline. This is a read only version of the page.
close
Skip to main content
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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 973 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 366 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 343

Last 30 days Overall leaderboard