Power Apps Collection Distinct Filter [With Different Data Types]

    Are you ready to work with Power Apps Collection Distinct Filter? This Power Apps tutorial will show us how to work with the Power Apps Collection Distinct Filter, including various scenarios.

    Also, we will explore some more examples related to distinct filters in the Power Apps Collection like:

    1. Power Apps Collection Distinct Filter With Choice Value
    2. Power Apps Collection Distinct Filter With Number
    3. Power Apps Collection Distinct Filter With Date

    Check out Power Apps Gallery Control Examples Download [20 Various Real Scenarios]

    Power Apps Collection Distinct Filter

    Let’s discuss how to use distinct filters in the Power Apps Collection.

    • The screenshot below represents two Power Apps Gallery Controls and two Button controls (Create Collection From SP List & Create Unique Collection).
    • When a user clicks the first button (Create Collection From SP List), the collection will be created from a SharePoint list and displayed in the first gallery control.
    • Similarly, when a user clicks the second button (Create Unique Collection), the distinct or unique records will be generated from the first collection and displayed in the second gallery control, as shown below.
    Power Apps Collection Distinct Filter

    Setup a SharePoint List

    The below represents a SharePoint List of Products having these many columns:

    ColumnsDatatypes
    IDNumber
    TitleSingle line of text
    VendorChoice
    StatusChoice
    QuantityNumber
    Sales DateDate and time

    Also, this SharePoint list has these many below records.

    PowerApps Collection Distinct Filter

    Now, let’s create a collection from this SharePoint list and filter the distinct values from the collection.

    • Insert a Power Apps Button Control and set its OnSelect property to the code below: [Not only button’s OnSelect but also, you can write the code below on Screen’s OnVisible or App’s OnStart property as per your need]
    OnSelect = ClearCollect(
        colProductDetails,
        Products
    )

    Where,

    1. colProductDetails = Collection Name
    2. Products = SharePoint List Name
    Power Apps Distinct Collection Filter
    • Then, add a gallery and set its Items property as:
    Items = colProductDetails
    Distinct Filter in Power Apps Collection
    • Now, to get all the distinct values from the Power Apps Collection, add another button and write the below formula on its OnSelect property:
    OnSelect = ClearCollect(
        colUniqueProducts,
        Distinct(
            colProductDetails,
            Title
        )
    )

    Where,

    1. colUniqueProducts = Provide a new collection name
    2. colProductDetails = Specify the created collection name
    3. Title = Provide the column name from the collection [that you want to display unique values]
    How to use Distinct Filter in Power Apps Collection
    • Add another Gallery control and set its Items property as:
    Items = colUniqueProducts

    Refer to the image below.

    Power Apps Collection Distinct
    • To display the unique collection results in the gallery, set the Label’s Text property as:
    Text = ThisItem.Value
    Power Apps Collection Distinct Filter Examples
    • Finally, save, publish, and preview the app. Click on the first button (Create Collection From SP List). The collection will be created and displayed in the first gallery control.
    • Next, click on the second button (Create Unique Collection), and all the unique values will be displayed in the second gallery control.

    This is how to work with the Power Apps Collection Distinct Filter.

    Power Apps Collection Distinct Filter With Choice Value

    Here, we will discuss how to work with Power Apps Collection Distinct Filter With Choice Value.

    • As you can see in the below image, a Vendor column (Choice column) is present in the collection. I want to filter the collection and display its distinct choice values.
    Power Apps Collection Distinct Filter With Choice Column
    • To achieve this, select the Button control (Create Unique Collection) and apply the code below on its OnSelect property as:
    OnSelect = ClearCollect(
        colUniqueProducts,
        Distinct(
            colProductDetails,
            Vendor.Value
        )
    )

    Where,

    1. colUniqueProducts = Provide a new Collection name
    2. colProductDetails = Specify the created collection name [refer to the above example]
    3. Vendor = Specify the Choice column from the collection
    Power Apps Collection Distinct Filter With Choice Value
    • Save, Publish, and Preview the app. Tap the second button (Create Unique Collection), and all the unique choice values will be displayed in the second gallery control.

    This is how to work with Power Apps Collection Distinct Filter With Choice Value.

    Power Apps Collection Distinct Filter With Number

    Now, we will see how to work with the Power Apps Collection Distinct Filter With the Number field.

    • Like the above examples, select the second button control (Create Unique Collection) and apply the formula below on its OnSelect property as:
    OnSelect = ClearCollect(
        colUniqueProducts,
        Distinct(
            colProductDetails,
            Quantity
        )
    )

    Where,

    1. colUniqueProducts = Provide a new Collection name
    2. colProductDetails = Specify the created collection name [refer to the first example]
    3. Quantity = Specify the Number column from the collection

    Refer to the image below.

    Power Apps Collection Distinct Filter With Number
    • Select the gallery and set its Items property as:
    Items = colUniqueProducts

    Where,

    colUniqueProducts = Created Collection name

    Power Apps Collection Distinct Filter With Number Column
    • Save, Publish, and Preview the app. Tap the second button (Create Unique Collection), and all the unique number values will be displayed in the second gallery control.

    This is how to work with the Power Apps Collection Distinct Filter With Number Field.

    Power Apps Collection Distinct Filter With Date

    In the same way, suppose we want to filter the distinct dates from the Power Apps Collection; then the code below will help you around.

    • Select the Button control (Create Unique Collection) and apply the formula below on its OnSelect property as:
    OnSelect = ClearCollect(
        colUniqueProducts,
        Distinct(
            colProductDetails,
            'Sales Date'
        )
    )

    Where,

    1. colUniqueProducts = Provide a new Collection name
    2. colProductDetails = Specify the created collection name [refer to the first example]
    3. ‘Sales Date’= Specify the Date column from the collection
    Power Apps Collection Distinct Filter With Date
    • Select the gallery and set its Items property as:
    Items = colUniqueProducts
    PowerApps Collection Distinct Filter With Date
    • Save, Publish, and Preview the app. Tap the second button (Create Unique Collection), and all the unique date values will be displayed in the second gallery control.

    This is how to work with Power Apps Collection Distinct Filter With Date Field.

    Additionally, you may like some more Power Apps tutorials:

    This Power Apps tutorial discussed working with the Power Apps Collection Distinct Filter, including various scenarios.

    Also, we explored some more examples related to distinct filters in the Power Apps Collection like:

    1. Working with Power Apps Collection Distinct Filter With Choice Value
    2. How to work with Power Apps Collection Distinct Filter With Number
    3. Power Apps Collection Distinct Filter With Date
    >