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 Apps
Unanswered

Count Variable

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone,

 

I need to create a variable that counts "+1" every day. I need this count to clear if my SharePoint list is set to "0" on the specified line.

 

My biggest question is how to create this variable that counts every day.

 

List: DateTurn
Column: Accident

Categories:
  • dinusc Profile Picture
    Microsoft Employee on at

    A bit more clarification would be helpful. If I understand the intended behaviour correctly, it looks like all you need is to store the current date in a variable (start_date) every time you find "0" in the specified column. When you need the proper count, you just need to get the current date and calculate the number of days between start_date and that date.If the last time you detected the "0" was 2 days ago then your count will be "2".

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Agreed with @dinusc here.

     

    For the current date when the "0" is found with the specified column field, it is recommended to store that information at the data source side. (You could also take use of SaveData function to keep that with the local device, but that would require the App to be opened with the same device, in order to get the proper saved date)

    As the Variable saved within App would clear its value when the App is closed and open again.

     

    If this is not meet your requirements, then please share more details and we will see if a more suitable solution could be offered.

     

    Regards,

    Michael

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    It would not be enough, because I need a variable to count until, in the SP list, you enter the time to zero and return to "0".

     

    I can clear the variable. But I just can not get her to count +1 every day

    I need to know a way I can count it every day, without having to store it anywhere. It would be possible?

  • dinusc Profile Picture
    Microsoft Employee on at

    Hello Antonio,

    Does the counter need to run in the applciation? For example, if I start the app and I see the counter = 4. Then the next time the application is started is in 2 days and when I start the app, the counter should be 6 (assuming the sp list did not have the time set to 0). In this case the counter state has to be saved somewhere in order to update it properly (since the app does not run 24/7). 

    Would you be able to share a bit more details about the intended behavior? I feel like there should be a much easier solution to the problem you're trying to solve.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello dinusc!

    That's right, I need a counter within the application, regardless if it will be opened every day or not (but will open every day yes). But how could I make an accountant in OnStart for example? Increase "+1" every time this app starts? It would be an option too.

  • dinusc Profile Picture
    Microsoft Employee on at

    You can definitely use the OnStart property. The problem is that after incrementing your counter, you would have to store it somewhere anyways in order to prevent losing that value when the application is turned off. After re-opening the application (the next day) you somehow need to retrieve the last value of the counter so you can increment it (if the time is not reset). 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I understood now .. But I would not use a row for each incremental number right? Because otherwise it would get too big!

  • dinusc Profile Picture
    Microsoft Employee on at

    No. This is why initially I was suggesting just to store the day value when the counter is reset (the empty time column situation). The only case you would have to store multiple day values is in case you would prefer to reset different application at different times (for example, when you have multiple "time" columns). In that case, I would just suggest either adding a new "reset_day" column to your existing list or creating a separate list to track that information.

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
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard