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 / How can I get a percen...
Power Apps
Answered

How can I get a percentage completed based off of a "true" value in a collection

(0) ShareShare
ReportReport
Posted on by 51
I am trying to get a count/percentage on how many "true" values are in a collection for each column based off a specific row into a gallery label.  So far I have tried this, but it does not give me a 100%.  It is either over or under 100%.  If all 5 columns show a "true" value, then the value will return as 105% instead of 100%.  Any advice or help would be appreciated.  Thanks 
 
 
 
Round(CountRows(
    Filter(
        colPercentages,
        projectnumber = ThisItem.projectnumber &&
        q1cbxanswer = "true"
    )
)/5*100, 0) + Round(CountRows(
    Filter(
        colPercentages,
        projectnumber = ThisItem.projectnumber &&
        q2cbxanswer = "true"
    )
)/5*100, 0) + Round(CountRows(
    Filter(
        colPercentages,
        projectnumber = ThisItem.projectnumber &&
        q3cbxanswer = "true"
    )
)/5*100, 0) + Round(CountRows(
    Filter(
        colPercentages,
        projectnumber = ThisItem.projectnumber &&
        q4cbxanswer = "true"
    )
)/5*100, 0) + Round(CountRows(
    Filter(
        colPercentages,
        projectnumber = ThisItem.projectnumber &&
        q5cbxanswer = "true"
    )
)/5*100, 0)
Categories:
I have the same question (0)
  • Verified answer
    Garima_PowerPlatform Profile Picture
    170 on at
    Hi,

    The issue you're encountering is due to the way you're calculating percentages for each column and then summing them up. When you sum them, if all the columns have a "true" value, the total exceeds 100% (105% in your case) because you're counting each "true" value separately and applying the percentage calculation to each of the five columns.

    To calculate the correct percentage, you should first determine how many of the five columns contain "true" values for each row and then calculate the percentage based on that count relative to the total number of columns (5 in this case).

    Here’s how you can adjust your formula:

    1. Count how many columns have "true" values for the specific row.
    2. Divide that count by the total number of columns (5).
    3. Multiply by 100 to get the percentage.
    Round(
        (
            CountRows(
                Filter(
                    colPercentages,
                    projectnumber = ThisItem.projectnumber && 
                    (q1cbxanswer = "true" || q2cbxanswer = "true" || q3cbxanswer = "true" || q4cbxanswer = "true" || q5cbxanswer = "true")
                )
            ) / 5
        ) * 100,
        0
    )


    However, a more straightforward approach would be to count the number of "true" answers across all columns in a single row and then calculate the percentage based on that count. Here's a formula that should work:

    Round(
        (
            (If(ThisItem.q1cbxanswer = "true", 1, 0) + 
            If(ThisItem.q2cbxanswer = "true", 1, 0) + 
            If(ThisItem.q3cbxanswer = "true", 1, 0) + 
            If(ThisItem.q4cbxanswer = "true", 1, 0) + 
            If(ThisItem.q5cbxanswer = "true", 1, 0)) / 5
        ) * 100,
        0
    )

    Thanks
  • Verified answer
    Patrick-Stamper Profile Picture
    51 on at
    This works great.  Thank you so much!  The 2nd option works the best, but I had to adjust for it to work for me, because I am using 2 different collections in the gallery. 
     
     
    Round(
      (
         (If(LookUp(colPercentages, projectnumber = ThisItem.projectnumber).q1cbxanswer = "true",1,0) +
          If(LookUp(colPercentages, projectnumber = ThisItem.projectnumber).q2cbxanswer = "true",1,0) +
          If(LookUp(colPercentages, projectnumber = ThisItem.projectnumber).q3cbxanswer = "true",1,0) +
          If(LookUp(colPercentages, projectnumber = ThisItem.projectnumber).q4cbxanswer = "true",1,0) +
          If(LookUp(colPercentages, projectnumber = ThisItem.projectnumber).q5cbxanswer = "true",1,0)) / 5
         ) 100,
         0
    )

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