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 / Count Button Clicks
Power Apps
Answered

Count Button Clicks

(0) ShareShare
ReportReport
Posted on by 792
Hi,

I have a requests for something that I have not come across how to do before.
 
The challenge is I have an app that has a button that currently copies something on Select, however to add to its functionality I want to build something that counts the amount of times this button is selected during a working day (the app is accessed by multiple users)
 
Is this doable if so what is the best approach to doing so?
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,121 Most Valuable Professional on at
    You can easily add a formula to increment a counter variable in the button's onSelect.  The hard part is that that variable is only available in that one user's app.  So you'll also need to retrieve the current value from a data source somewhere, increment that and patch it back if you want multiple users.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Kmayes Profile Picture
    792 on at
     
    I thought the complexity would be the multiple users accessing. I wondered if it was easier to add an item to a list which then in hand would capture the details, but was hoping there would be a slicker way of doing so without excess building
  • Suggested answer
    Gabriel G. Profile Picture
    831 Moderator on at
    Hi,
     
    Like @Pstork1 mentioned, there is no way to keep a variable through multiple instances of an app. Anyway, it is not a big deal to keep an increment integer somewhere in a db.
     
    If your button simply create records, you probably already have that value hidden in your db since you can simply calculate how much records is created between Today@00:00 and Today@23:59.
     
    I hope it helps!
    ____________________________________________
     
    Please click Does this answer your question 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 a Like.
  • Verified answer
    MS.Ragavendar Profile Picture
    6,274 Super User 2026 Season 1 on at
    Approach 1: Using a SharePoint List 
    • Create a SharePoint List name 'Button Clicks' with columns (UserEmail,ClickDate, Count)
    • Button (OnSelect) Enter the Patch Code.
    •  This logs each click separately with the user’s email and date.
    Patch(
        ButtonClicks, 
        Defaults(ButtonClicks), 
        {
            UserEmail: User().Email,
            ClickDate: Today(),
            ClickCount: 1  // Each press is logged separately
        }
    )
    
    Total Clicks for the Day
     
    Insert a label or Textbox control and filter the records based on the date as shown.
     
    CountRows(Filter(ButtonClicks, ClickDate = Today()))

    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
     
  • MS.Ragavendar Profile Picture
    6,274 Super User 2026 Season 1 on at
    Hi,
     
    If you feels the below approach will create multiple entries for one user, try this .
     
    The list schema remains the same, we changing only in the patch, OnSelect of Button.
     
    ClearCollect(
        colExistingRecord, 
        Filter(ButtonClicks, UserEmail = User().Email, ClickDate = Today())
    );
    
    If(
        CountRows(colExistingRecord) > 0,
        // If a record exists, update it
        Patch(
            ButtonClicks,
            First(colExistingRecord), 
            { ClickCount: First(colExistingRecord).ClickCount + 1 }
        ),
        Patch(
            ButtonClicks, 
            Defaults(ButtonClicks), 
            {
                UserEmail: User().Email,
                ClickDate: Today(),
                ClickCount: 1
            }
        )
    );
    
     
    Label Property
     
    Sum(Filter(ButtonClicks, ClickDate = Today()), ClickCount)
     
  • Kmayes Profile Picture
    792 on at
    @GabGadou 

    Unfortunately the button isn't currently creating any records its current purpose is to create copy text, but off the back of the button I wanted to understand how many time that button is being clicked by the multiple users. Otherwise id have lifted from a database (had there been one) how many clicks occurred.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 493 Most Valuable Professional

#2
11manish Profile Picture

11manish 479

#3
Haque Profile Picture

Haque 328

Last 30 days Overall leaderboard