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 / Calculate specific val...
Power Apps
Answered

Calculate specific value in a collection

(0) ShareShare
ReportReport
Posted on by 62

Hello guys, 

 

This is a little hard to explain but here we go, I've made this concept:

OnSelect().Button:

ClearCollect(exampleCol;
 {Item: "Car type A"; Speed: 250; Transmission: "manual"};
 {Item: "Car type A"; Speed: 237; Transmission: "automatic"};
 {Item: "Car type A"; Speed: 250; Transmission: "manual"};
 {Item: "Car type A"; Speed: 215; Transmission: "automatic"};
 {Item: "Car type B"; Speed: 115; Transmission: "manual"};
 {Item: "Car type B"; Speed: 103; Transmission: "automatic"};
 {Item: "Car type B"; Speed: 168; Transmission: "manual"};
 {Item: "Car type B"; Speed: 159; Transmission: "automatic"}
 );;

ClearCollect(resultExampleCol;
 Sort(
 AddColumns(
 GroupBy(
 exampleCol;
 "Item";
 "Speed";
 "Transmission"; 
 "mostOften"
 );
 "total";
 CountRows(mostOften)
 );
 total;
 SortOrder.Descending
 ));;

The first part is self explanatory, i'm collecting a few values, note for the 2 repeated one "type A/250/manual".

The second part I calculate the most recurrent value and group into a single row, this is the result:

Gallery().Items = resultExampleCol:

Merida_0-1694461854947.png

The thing that I want to do here, it's calculate the average speed between the 3 Car type, in this case the result should be something like:

Car Type A / avg speed: XX / manual

Car Type A / avg speed: XX / automatic

Car Type B / avg speed: XX / manual

Car Type B / avg speed: XX / automatic

Car Type A / avg speed: XX / manual

Car Type A / avg speed: XX / automatic

 

I would apreciate if someone can give me a hand on this,

Thanks!

Categories:
I have the same question (0)
  • Verified answer
    Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @Merida - try:

     

    ClearCollect(
     myExampleSolution,
     DropColumns(
     AddColumns(
     GroupBy(
     resultExampleCol,
     "Item",
     "Transmission",
     "GroupedItems"
     ),
     "Average of Speed",
     Average(
     GroupedItems,
     Speed
     )
     ),
     "GroupedItems"
     )
    );
    

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

  • Merida Profile Picture
    62 on at

    oh perfect, I dind't knew that it was like that, 

    Thanks!

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 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard