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 / what is the synatx for...
Power Apps
Answered

what is the synatx for this month and next month?? Thanks

(0) ShareShare
ReportReport
Posted on by 1,994

HI

 

May I know what is the syntax for  this month and next month 

 

is it 15 and +15?

 

bbsin_0-1626055511681.png

 

Categories:
I have the same question (0)
  • Verified answer
    v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @bbsin ,
    How and where do you want to display of this month and the next month? 
    Do you want to display the date of the first day and the last day in the current month and the next month?
    If yes, you can try below formula.
    To get the date of the first day of this month, you can use this formula:

    Date(Year(Now()), Month(Now()), 1)

    To get the date of the last day of this month, you can use this formula:

    DateAdd(
    DateAdd(
    Date(Year(Now()),Month(Now()),1),
    1,
    Months
    ),
    -1,
    Days
    )

     

    To get the date of the first day of next month, you can use this formula:

    DateAdd(
    Date(Year(Now()),Month(Now()),1),
    1,
    Months
    )

    To get the date of the last day of next month, you can use this formula:

    DateAdd(
    DateAdd(
    Date(
    Year(Now()),
    Month(Now()),
    1
    ),
    2,
    Months
    ),
    -1,
    Days
    )

    Using above formula where required to meet your actual requirement.

    Best regards,

    Allen

  • bbsin Profile Picture
    1,994 on at

     

    .

  • bbsin Profile Picture
    1,994 on at

    hi @v-albai-msft 

     

    Can I check with u the number for next month is not right, can you advise as it's show as 9/9/  right?  I am using today as reference. thanks

    bbsin_0-1626063843889.png

     


    {
    DisplayName: "Next Month",
    StartDate: DateAdd(
    Date(Year(Now()),Month(Now()),1),
    1,
    Months
    ),
    EndDate: DateAdd(
    Today(),
    -60 - Weekday(
    Today(),
    StartOfWeek.Monday
    ) + 60,
    Days
    )
    }
    )

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

    Hi @bbsin ,

    The code in Text and the code inside your screenshot are different. 

    Anyway, from your information, I am not sure which date do you want to display.

    If today is 12/07/2021, do you want to display 12/08/2021?

    If yes, just try this(edit below code to show any date based on Today()):

    Date(Year(Today()), Month(Today())+1, Day(Today()))

    valbaimsft_0-1626073164317.png

    Best regards,

    Allen

  • bbsin Profile Picture
    1,994 on at

    Hi Allen,

     

    Check with you there is error the dropdown not showing.. can you kindly advise, 

    ClearCollect(
    colTimeFilter,
    {
    DisplayName: "This Week",
    StartDate: DateAdd(
    Today(),
    1 - Weekday(
    Today(),
    StartOfWeek.Monday
    ),
    Days
    ),
    EndDate: DateAdd(
    Today(),
    1 - Weekday(
    Today(),
    StartOfWeek.Monday
    ) + 6,
    Days
    )
    },{
    DisplayName: "This Month",
    StartDate: Date(Year(Now()), Month(Now()), 1),

    ),
    EndDate:
    DateAdd(
    DateAdd(
    Date(Year(Now()),Month(Now()),1),
    1,
    Months
    ),
    -1,
    Days)
    },
    {
    DisplayName: "Previous Month",
    StartDate: DateAdd(
    Today(),
    -30 - Weekday(
    Today(),
    StartOfWeek.Monday
    ),
    Days
    ),
    EndDate: DateAdd(
    Today(),
    -30 - Weekday(
    Today(),
    StartOfWeek.Monday
    ) + 30,
    Days
    )
    },
    {
    DisplayName: "Next Month",
    StartDate: DateAdd(
    Date(Year(Now()),Month(Now()),1),
    1,
    Months
    ),
    EndDate: DateAdd(
    DateAdd(
    Date(
    Year(Now()),
    Month(Now()),
    1
    ),
    2,
    Months
    ),
    -1,
    Days
    ) }
    )
    )

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

    Hi @bbsin ,

    Seems that you want to show all days between two given date in dropdown.

    If yes, you code will not work. You can check the results and data structure of your collection. So for your question, I do a test on my side. For example, Today is 13/07/2021( Today() ), one month later is 13/08/2021( Date(Year(Today()), Month(Today())+1, Day(Today())) ) , I want to show 30 days between these two day, so here is the code:

    With(
    {startDate:Today(),
    sequenceDays: Sequence(DateDiff(Today(),Date(Year(Today()), Month(Today())+1, Day(Today())), Days) + 1)
    },
    ClearCollect(colDates,
    AddColumns(sequenceDays,
    "Date",
    DateAdd(startDate, Value - 1, Days)
    )
    ))

    valbaimsft_0-1626166565609.png

     

    Then in the dropdown, use this formula:

    colDates.Date

    Edit the code based on your actual requirement. I would suggest you create different collections for "This Week", "This month", "Previous month". 

    Best regards,

    Allen

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
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard