There are several count functions in Power Apps, and all of them draw inspiration from Excel. I will detail them all in this reference but, if you’re familiar with them in Excel, you will be comfortable with them in Power Apps. In the case of the “Count Function,” it returns the number of rows in a single-column table.

Usage

It follows a simple pattern.

  1. Table (single-column)

Example:

Count([1,2,3])

will return 

3

You can also use the Table function to generate a table and then return the number of elements. In this case, you should generate it first into a variable and then use the function; otherwise, the table will disappear as soon as the function runs.

Set('TableVariable', Table({Number:1}, {Number:2}, {Number:3}))

and then you can do

Count(TableVariable)

Limitations

You can only use the function in a single-column table. There isn’t a defined limit to this function, but since it’s created and managed in the device, but you should be careful to count huge datasets to avoid your users’ waiting times or slow applications.

Recommendations:

  1. Don’t nest it. There’s no real reason to do it, but if you find yourself in a situation where you have nested Count functions in a formula, you should review it because something’s not right.
  2. Use the smallest number of elements possible in a table. The function is quite fast to run, but with huge tables it may take some time.
  3. You can count the elements of a function or a formula. If you do so, keep them to a minimum so that you can debug easily the app in case of issues or undesired values.
Please note that formulas may have localization-based differences. For example, you should write “Count” with “,” separating each of the arguments, but if your regional settings are set to Portugal you should use “ ;” instead.

Sources:

Count, CountA, CountIf, and CountRows functions in Power Apps 

Back to the Power Apps Function Reference

Photo by Steve Johnson on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

Leave a Reply

Your email address will not be published. Required fields are marked *