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 / Create Index with year...
Power Apps
Answered

Create Index with year and month

(0) ShareShare
ReportReport
Posted on by 32

Hello, 

So I have an issue that I'm really struggling to resolve. 
Here I want to create invoice column in sp  where I can generate invoice format like "yyyymm and the following invoice number" using date format and I also reset the invoice number when the month is change.
like: 

  • 20210201
  • 20210202
  • 20210203
  • 20210204

and when month is change February to march it would be look like this.

  • 20210301
  • 20210302
  • 20210303
  • 20210304
     here is my code that I used, but it only displaying the format not reset I need logic of resetting invoice number could you help me.

    Set(GenChallan,Last(Sort('Challan List',ID,SortOrder.Ascending)).Title);
    UpdateIf('Challan List',ID=SortOrder.Ascending,{Title:Concatenate(""&Text(Today(),"[$-en-US]yyyy,mm,")&"",Text(Right(GenChallan,3)+1))});
Categories:
  • Verified answer
    rubin_boer Profile Picture
    4,843 Super User 2024 Season 1 on at

    hi @Mehta_Tech 

     

    A slight change is to breakdown the code (same thing you doing just differently):

    //Get the last entry for month from the title

    Set(_MonthLastEntry,Mid(Last(_InvoiceIndex).Invoice,5,2));

    //increase the invoice count if the current month number = that value. im using a txtbox to illustrate

    Set(_InvNumber,If(txtMonth.Text = _MonthLastEntry, _InvNumber+1,1));

     

    the collection shows the result

    Without the if statement in increasing the invoice count

    rubin_boer_0-1613032052677.png

     

    With the if statement

    rubin_boer_1-1613032141434.png

     

    I hope this can help

     

     

     

     
  • Mehta_Tech Profile Picture
    32 on at

    Can you please elaborate how it's work in my code. 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard