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 / Counting specific stri...
Power Apps
Answered

Counting specific strings in a gallery across multiple Columns

(0) ShareShare
ReportReport
Posted on by 40

So I have a gallery in my app that shows statistics of people who have played a game. The players names are entered, and saved. I would like to count how many games a person has taken place in. From the data set I have below a player could be entered in as Player1 during one game and then end up a different player during another game. So how can I count the total times a name occurs in the gallery/dataset?

 

Player1Player2Player3Player4
PeterSamLeeJane
JaneLeePeterSam
LeePeterJaneSam
PeterJaneSamLee

 

I can successfully count the number of times a name occurs in one column:

CountIf(GalleryPlayerStats.AllItems, Player1 = "Peter")  ->  result is 2

 

But I cant figure out how to count multiple columns, I have tried this but it doesn't return the correct number

CountIf(GalleryPlayerStats.AllItems, (Player1 || Player2 = "Peter")) -> result is still 2 

 

So I am not sure how to setup the equation, thanks for the help

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @BaronKiespert ,

    Try

    CountIf(
     GalleryPlayerStats.AllItems, 
     Player1 = "Peter"
    ) +
    CountIf(
     GalleryPlayerStats.AllItems, 
     Player2 = "Peter"
    ) +
    CountIf(
     GalleryPlayerStats.AllItems, 
     Player3 = "Peter"
    ) +
    CountIf(
     GalleryPlayerStats.AllItems, 
     Player4 = "Peter"
    )

     

    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.

  • BaronKiespert Profile Picture
    40 on at

    You know, that makes a lot more sense then what I was trying to do. 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

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