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 to count dropdown ...
Power Apps
Unanswered

How to count dropdown options within a Form

(0) ShareShare
ReportReport
Posted on by 59

Hi, I have a "master form" that consolidates about 35 answers given by users through different screens, I need to count the number of filled questions in my "master form" so that I can calculate a completion rate. 

I tried creating a variable called Count_Fields_Filled and use it in the OnChange property of every field: 

the datacardvalue589 is a dropdown list within my form.

If(
 DataCardValue589.Selected.Value = Blank(),
 Count_Fields_Filled + 1,
 Count_Fields_Filled
)

Then I used the Count_Fields_Filled in a label, just show the total count but it shows 0 so it is not working. 

 

How could I count if the field has a value selected by the user? I also tried with IsEmpty and IsBlank but still not working,

If(
 IsEmpty(DataCardValue589.Selected.Value),
 Count_Fields_Filled + 1,
 Count_Fields_Filled
)

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @JohanSmith-07

    Set(Count_Fields_Filled, Count_Fields_Filled+1)

  • Tony_Bowes_BP Profile Picture
    280 on at

    It feels like this code would fire in EACH OnChange, so modifying the same variable 15 times would give you a count of 15 when in fact it's only one answer. 

     

    A potentially better way to do it would be to simply display the results of a formula that adds up all non-blank answers. 

    Formula would be something like:

    (If(IsBlank(TextInput1.Text),0,1)
     + If(IsBlank(TextInput2.Text),0,1)
     + If(IsBlank(TextInput3.Text),0,1)
     )

     

  • JohanSmith-07 Profile Picture
    59 on at

    Thanks @Tony_Bowes_BP for some reason, when I delete a response from the form, the result is still counting it, it's like the result keeps on the cache memory or something, the following image should count 1 but as it had a response in 1.1 and then I delete it, it kept the counting. Any alternative to prevent this to happen?

    2023-01-23_8-16-32.png

  • Tony_Bowes_BP Profile Picture
    280 on at

    For combo boxes, try checking against the value of the selected item: Eg: IsBlank(ComboBox1.Selected.Value1) 

  • JohanSmith-07 Profile Picture
    59 on at

    @Tony_Bowes_BP I did it but I'm having the same result

  • Tony_Bowes_BP Profile Picture
    280 on at

    Here's an example of only 1 tex box filled: 

    Tony_Bowes_BP_0-1674543305562.png

    Then selecting one of the combobox items:

    Tony_Bowes_BP_1-1674543363248.png

     

    Then deleting the selection:

    Tony_Bowes_BP_2-1674543408471.png

     

    Code for the text label on the left is:

     

    Concatenate((If(IsBlank(TextInput1.Text),0,1)
     + If(IsBlank(TextInput2.Text),0,1)
     + If(IsBlank(ComboBox1.Selected.Value1),0,1))
     , " out of 3") 

     

     

    Depending on your combobox it might not be Value1 but the column name of the droplist options. 

    Another way to debug would be to link up a TextLabel to the same value that you are trying to compare so you can visually see what the value is.

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard