web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Distinct values from a...
Power Apps
Answered

Distinct values from a data source

(1) ShareShare
ReportReport
Posted on by 52

Hi all,

 

DataSource: 

Task       Project      

T123      P02           

T999      P02           

T123      P02           

T123      P04           

T873      P07           

T123      P02    

 

So, given the previous DataSource I want to know if it's possible to filter the information in order to produce the following Data Result. In other words, I want to join the lines that have both the same Task and Project.

 

Data Result:

Task      Project     

T123     P02           

T999      P02          

T123      P04          

T873      P07          

 

Thanks in advance.

Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi RuiBarbosa,

     

    You can use the "Distinct" function in PowerApps to summarize records of a table, removing duplicates.

     

    The Distinct function evaluates a formula across each record of a table. Distinct returns a one-column table that contains the results, with duplicate values removed.

    Fields of the record currently being processed are available within the formula. You simply reference them by name as you would any other value. You can also reference control properties and other values from throughout your app. For more details, see the examples below and working with record scope.

     

    Distinct( Table, Formula )

    • Table - Required. Table to evaluate across.
    • Formula - Required. Formula to evaluate for each record.

     

    Example:

    If you had an Employees table that contained a Department column, this function would list each unique department name in that column, no matter how many times each name appeared in that column:

    Distinct(Employees, Department)

     

    Regards,

    Mona

  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    As @v-monli-msft mentioned, you can use the Distinct function to retrieve the unique value of the task/project combination. This function, however, will generate a table with a single row, so if combining the values is something that works for your scenario, then that would be the best choice:

    Distinct(DataSource, Task & "-" & "Project)

    That will give you a list (table) with one column, and the value is the concatenation of the task and the project, separated by a " - ".

     

    If, however, you still need to maintain the two columns (Task and Project) separated, and possibly use the values from other columns in the data source, you can use the GroupBy function to do that. For example, if you have the data source with the following values:

    Task Project Value
    T123 P02 1
    T999 P02 2
    T123 P02 3
    T123 P04 4
    T873 P07 5
    T123 P02 6

    You can use the formula below to select only the distinct values of the task/project combination, and the first of the values of each:

    AddColumns(
     GroupBy(coll, "Project", "Task", "ProjectAndTask"),
     "FirstValue",
     First(ProjectAndTask).Value)

    Hope this helps!

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi

     

    I am trying to do exactly this, but I am confused about what you referring to as 

     

    Coll

    and the other source?

     

    Could you expand

     

    Jese

  • irondinges Profile Picture
    100 on at

    Apologies for resurrecting an old thread, but this was the top result when I researched this problem and the solution did not work.

    Posting my solution below for anyone else that stumbles on this issue in the future.

     

    What worked for me was to change the items property to the following:

    Distinct(Names.Department; Department)

     

    In my case, I have an excel document on one drive that my app is connecting to. This document has 4 columns: Name, Branch, Department and CellNumber.

    I was trying to implement filters for the display gallery by using a Combobox that uses a distinct list of Departments. Using the solution as described: Distinct(Names; Branch) did not work, but changing it to Distinct(Names.Department; Department) did the trick.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard