How to Count Rows in Power Apps Collection?

    Do you know how to count all rows/records in the Power Apps collection? If not, no need to worry!

    This Power Apps tutorial will teach complete information about how to count rows in Power Apps Collection, and also many more like:

    • How to Count All Rows in Power Apps Collection manually
    • Count All Rows/ Records in a Power Apps Collection from the SharePoint List

    Power Apps Count Functions

    PowerApps Count function helps count all records in a table. Also, it counts all items that satisfy a condition.

    Refer to the below table:

    FunctionsDescriptionSyntax
    Count()It counts the number of items in a single-column tableCount(SingleColumnTable)
    CountAIt counts the number of items that are not blank in a table. This Powerapps CountA function includes an empty text (” “) in the countCountA(SingleColumnTable)
    CountIfThis is the Power Apps function that helps to count the number of items in a table that are true for a logical formulaCountIf (Table, LogicalFormula)
    CountRowsThis CountRows function helps to count the number of items or records in a tableCountRows(Table)

    NOTE:

    All the above Powerapps Count functions (Count, CountA, CountIf, CountRows) always returns a number value.

    How to Count Rows in Power Apps Collection

    Now, we will see how to count all rows in the Power Apps collection with a simple example.

    Example:

    • Suppose there is a Power Apps collection that contains some records. I want to calculate the number of records or items in the Powerapps collections.
    • The below screenshot represents the Power Apps Collection named “colBooks”. It has three different types of items. The number of records I want to show in a Text label control.
    Count Rows in a Power Apps Collection
    • I have applied the formula below on the Label’s Text property to do so:
    Text = CountRows(BookCollection)

    Where,

    1. CountRows() = This Power Apps CountRows() function helps to count the number of rows in a table/collection
    2. colBooks = Power Apps Collection Name
    • Once you apply this formula, the number of collection items will be displayed in the label control, as shown in the screenshot below.
    Power Apps Collection Count Rows

    This is how we can count rows in the Power Apps Collection.

    Count Rows in Power Apps Collection [From SharePoint List]

    Here, we will discuss how to count all rows/records in the Power Apps collection from a SharePoint list with a simple example.

    Example:

    I have a SharePoint Online list named “Employee Onboarding” and this list contains the below fields.

    Column NameData Type
    Employee IDDefault single line of text
    Employee NameA single line of text
    EmailA single line of text
    GenderChoice
    Joining DateDate and time

    Refer to the below screenshot:

    Count Rows in Power Apps Collection

    In Power Apps, there is a Data table control and a Text label. this data table displays all the collection records and the text label displays all rows/records count as in the screenshot below.

    Count Rows in the  Power Apps Collection

    To do so, follow the below steps.

    1. Open Power Apps -> Create Blank Canvas app and connect it to the respective SharePoint list as shown below.

    How to Count all Rows in Power Apps Collection

    2. Select the App object [from left navigation] and set its OnStart property to the code below.

    OnStart = ClearCollect(
        colEmployee,
        'Employee Onboarding'
    );

    Where,

    • colEmployee = Collection Name
    • ‘Employee Onboarding’ = SharePoint Online List
    How to Count all Rows in a Power Apps Collection

    3. Insert a Data table control and set Its Items property as:

    Items = colEmployee

    4. To display the collection fields on the data table, click on the Edit fields options and add respective fields as shown below.

    How to Count all Rows in the Power Apps Collection

    5. Insert a Text label and set its Text property to the code below.

    Text = "Total Number of Rows in collection: " & CountRows(colEmployee)"

    Where,

    • CountRows() = This function is used to count the number of rows/records in a table
    • colEmployee = Power Apps collection name
    Count all Rows in Power Apps Collection

    6. Once the app is ready, Save, Publish, and Preview the app. The text label shows all collection rows or records count as in the screenshot below.

    Count all Rows in a Power Apps Collection

    This is how to count all rows in a Power Apps collection from the SharePoint list.

    Conclusion

    This Power Apps tutorial taught in detail information about the Count rows in a Power Apps collection, including:

    • How to Count All Rows in Power Apps Collection manually
    • Count All Rows/ Records in Power Apps Collection from SharePoint List

    Also, you may like some more Power Apps tutorials:

    >