Forum Discussion

Bruno62's avatar
Bruno62
Copper Contributor
Feb 16, 2023

different dates with TEXT()

Hi,    i have some problems with date in a List on Sharepoint i would like use the date to make an order number like : YYYYMMDD-XX : XX is a number from 0 to X. i would like to reset this number e...
  • SvenSieverding's avatar
    Feb 19, 2023

    Hi Bruno62,

    this is complicated and will not work with a calculated formula alone. You have to create your own "Counter" Logic if you basically want to count all elements that have been created today

    I would use a Power Automate flow

    • That triggers when an item in that list is created
    • That then retrieves all items from that list that have been created today
    • Counts them
    • Adds 1
    • Updates this item and sets a textfield to "concat(formatDateTime(utcNow(),'YYYYMMDD'),'-',@ListItemCountFromPrevious)"

    For the formatting of the dates (Assuming "created" was a date in february)

     

    MONTH(created)


     returns the month, so returns a 2.

    TEXT(MONTH(created);"MM")


    first calculates the month of the created date as a "2" and then takes that "2" and tries to formats it using the "MM" date format. This is a wierd syntax as MONTH(created) does not return a date.

    Just use this formula instead to get the month part of a date with leading zeros

    TEXT(created;"MM")


    Best Regards,
    Sven

     

Resources