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 / Count Number of Likes
Power Apps
Answered

Count Number of Likes

(0) ShareShare
ReportReport
Posted on by

Hi All,

i have a simple requirement, where in the application i have a like button which allows the user to like the item. The like button also gets disabled after a person has liked the item. 
All of this data is displayed in a gallery.
All i want to do now is to count the number of likes per item in a label and display it in my gallery. Here is a screenshot of my gallery.
Gallery item with like button. i want to count the number of likes per item in my gallery.Gallery item with like button. i want to count the number of likes per item in my gallery.

Categories:
I have the same question (0)
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Hi,
    Can you share a bit more about your setup? Assuming you are storing likes in a related entity (linked to users/people entity), have you tried something like this"
    CountRows(ThisItem.Likes) OR
    CountRows(Filter(Likes, User = ThisItem)

    Let me know if this helps.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit Bhatia
    https://www.thepoweraddict.com
  • Community Power Platform Member Profile Picture
    on at

    @PowerAddict my database is sharepoint which is not considered as database but yes. Below is my setup for my likes List in sharepoint. None of this is a people picker column all are single line text. 
    so the count rows function that you have defined should run on the on visible of the screen or when the user clicks on the like button. 
    My like button patches the data into the likes list with the ID , Email and user name. ignore the number of likes field in the list.

     
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Was there an attachment that you forgot to attach?
  • Community Power Platform Member Profile Picture
    on at

    @PowerAddict sorry here you go..
    image.png

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Can you try something like this?

    Setting the Text property of a label (within the gallery) to:
    CountRows(LikesList, Email = ThisItem.Email)

    Let me know if this helps.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit Bhatia
    https://www.thepoweraddict.com
  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @Anonymous ,

    Could you please share more details about the Patch formula you used to patch data back to your Like List?

    Do you patch the ID column value from your Gallery back to the Title column in your Like List?

    Further, do you want to count the number of likes per item in your Gallery?

     

    Based on the needs that you mentioned, I think the Filter function and CountRows function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

    Add a Label control in your Gallery, set the Text property to following:

    CountRows(Filter('Like List', Title = Text(ThisItem.ID)))

    Note: Please set the "Data row limit for Non-delegable queries" option to maximum value -- 2000 within Advanced settings of App settings of your app.

     

    If you want to disable the Like Icon for the user who has liked current item within your Gallery, please take a try with the following workaround:

    Set the DisplayMode property of the Like Icon in your Gallery to following:

    If(
     !IsBlank(LookUp('Like List', Title = Text(ThisItem.ID) && Email = User().Email)),
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard