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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Finding most common value
Power Apps
Unanswered

Finding most common value

(0) ShareShare
ReportReport
Posted on by 271

Hi.

I am trying to identify the most common value in an excel column and return this into a text label in my app.

 

It feels like this should be straightforward, but I am struggling a little bit.

 

the table name is ‘predictions’ and column name is ‘CountryName’. 

Is anybody able to help? I have read several blogs on this, but just cannot make anythinv work!

Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @Gwill1983 ,

    you can use something like this formula and put this in the Text property of the label:

    First(SortByColumns(
     AddColumns(
     GroupBy(predictions, "CountryName", "Grouped"),
     'Count',
     CountRows(Grouped)
     ),
     "Count",
     Descending
    )).CountryName

     


    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.

  • Gwill1983 Profile Picture
    271 on at

    Thanks. That is returning a fair few errors (8). It seems ok until I enter the CountRows(Grouped) part, but it doesn’t recognise Grouped as anything.

     

  • Shravyashree_01 Profile Picture
    174 Moderator on at

    Hi @Gwill1983  , Please use the below clearcollect OnStart or OnVisible of the screen

     ClearCollect(colPredictionValue, Sort(AddColumns(GroupBy(predictions,CountryName,NewGroup),CountRows,CountRows(NewGroup)),CountRows,SortOrder.Descending)); 

    Now, for the TextLabel use the below code

     

    First(colPredictionValue).CountryName 

    Let me know if it solves the issue !

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard