Latest Posts

PowerApps count non-blank values in Single-column table


The CountA function in Power Apps is used to count the number of non-blank values in a column of a single-column table or collection. This function is useful for scenarios where you need to determine the number of filled entries in a dataset, especially when dealing with optional fields that might contain blank values.

PowerApps – CountA() function Syntax

CountA(SingleColumnTable)

  • SingleColumnTable: The table from which you want to count the non-blank values. This should be a single column table or collection.

Notes:

  1. This function includes empty text (“”) in the count.
  2. Handling Blanks: Ensure that your data source or collection correctly represents blank values to avoid incorrect counts.
  3. Delegation: Be mindful of delegation limits when using CountA with large data sources. Ensure that your formulas are delegable to handle large datasets efficiently.

PowerApps - Count Non-Blank Values in a Collection

Suppose you have a collection named Products with some blank values in the ProductName column, and you want to count the number of non-blank product names.

  1. Create the Collection:

ClearCollect(Products,

    Table(

        { ProductName: "Laptop},

        { ProductName: Blank()},

        { ProductName: "Monitor"}

    )

);

  1. Count Non-Blank Product Names:
    • Add a Label control.
    • Set the Text property of the Label to:

CountA(Products)

This will display the number of non-blank product names in the Products collection, which is 2.

PowerApps - Count Non-Blank Values in a Data Source

Suppose you have a SharePoint list named Employees with some blank values in the Email column, and you want to count the number of non-blank email addresses.

  1. Connect to the SharePoint List:
    • In Power Apps, go to the Data tab.
    • Add a data source and connect to your SharePoint site and list (Employees).
  2. Count Non-Blank Email Addresses:
    • Add a Label control.
    • Set the Text property of the Label to:

CountA(Employees)

This will display the number of non-blank email addresses in the Employees SharePoint list.

PowerApps - Combine CountA with Other Functions

You can combine CountA with other functions to perform more complex operations. For example, count the number of non-blank values in a filtered collection.

  1. Filter and Count Non-Blank Values:
    • Add a Label control.
    • Set the Text property of the Label to:

CountA(Filter(Products, Price > 400))

This will count the number of non-blank product names for products with a price greater than 400.



We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2024 Code SharePoint