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 / A numberfield to autoi...
Power Apps
Answered

A numberfield to autoincrement and reset back to 1 monthly

(0) ShareShare
ReportReport
Posted on by 12

Hi all, 

 

Is it possible to let a number field autoincrement by 1 when a form is submitted, and it will autoreset back to 1 on a monthly basis? 

 

Thanks! 😁

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @CHEWENGCHIN,

     

    In case your Auto Number each month does not exceed 2000 rows, you could use the following code in the Default property of the Auto Number DataCardValue:

    With(
     {
     wFirstOfMonth: DateTimeValue(
     Date(
     Year(Today()),
     Month(Today()),
     1
     )
     ),
     wLastOfMonth: 
     Date(
     Year(Today()),
     Month(Today()) + 1,
     0
     ) + Time(23,59,59)
     
     },
     CountRows(
     Filter(
     //Change datasource to the correct table/list name
     DATASOURCE,
     Created >= wFirstOfMonth && Created <= wLastOfMonth
     )
     )
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Surendran Ravindran Profile Picture
    212 on at

    @CHEWENGCHIN 

     

    Regarding Model driven Apps/CRM

     

    Out-of-box autonumber cant be resetted

     

    So , to Acheive this we have to use Sync Plugin 

     

    Maintain a separate table/entity (e.g., AutoNumberConfig) that stores the current sequence, year, and a lock column/field.

    The first step in the auto number plugin is to update the lock field (create a new guid) in the AutoNumberConfig record. current will lock the row, such that if another record is produced at the same time, it will be delayed until current row is completed.
    Then, in your auto numbering logic, determine whether the current month differs from the last saved month. If so, the series is reset; otherwise, the sequence is increased.

    Save the current record and the AutoNumberConfig row with the year and sequence.

     

    Regards

    Surendran Ravindran

     

     

  • CHEWENGCHIN Profile Picture
    12 on at

    Hi @LaurensM 😁

     

    Thanks for your help, but the AutoNumber starts from 0 instead 1. 

     

    Could you please make it starts on 1? 

    Thanks !

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @CHEWENGCHIN,

     

    Glad to help! 😊

    We only need a small adjustment to achieve that. Add + 1 after the With() statement:

    With(
    //See previous comment for the full code...
    ) + 1

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • CHEWENGCHIN Profile Picture
    12 on at

    Hi @LaurensM 😁

     

    Great! It's working now.

     

    Thanks for your help !

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard