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
Answered

Formula Help

(0) ShareShare
ReportReport
Posted on by 20

Can someone please tell me why my formulas dont work?

 

Set(_CurrentDate,Today());
Set(_DateSelected,_CurrentDate);
Set(_FirstDayofMonth,DateAdd(_DateSelected,1 -Day(_DateSelected,TimeUnit.Days));
Set(_FirstDayinView, DateAdd(_FirstDayofMonth,Weekday(_FirstDayofMonth)-2+1),TimeUnit.Days));
Set(_LastDayofMonth,DateAdd(_FirstDayofMonth,1,TimeUnit.Months),-1,TimeUnit.Days));
Set(_MinDate,DateAdd(_FirstDayofMonth,-(Weekday(_FirstDayofMonth)-2+1),Days));
Set(_MaxDate,DateAdd(_FirstDayofMonth,-(Weekday(_FirstDayofMonth),-2+1),Days)42,Days)))

Categories:
  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    Hi @Pagie,

     

    Can you please post the errors you are getting.

  • Pagie Profile Picture
    20 on at

    Pagie_1-1697974003324.pngPagie_2-1697974062869.png

     

  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    @Pagie 

     

    These formulas look like they are coming from the Calendar template? Can you please send a screen shot of the code in the OnVisible property of your 'Main Screen'

  • Pagie Profile Picture
    20 on at

    Hi Yeah i was following the video trying to learn.

    Pagie_0-1697975084856.png

     

  • Verified answer
    AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    @Pagie 

     

    Try this

     

    Set(_CurrentDate, Today());
    Set(_dateSelected, _CurrentDate);
    Set(_firstDayOfMonth, DateAdd(_dateSelected, 1 - Day(_dateSelected), TimeUnit.Days));
    Set(_firstDayInView, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days));
    Set(_lastDayOfMonth, DateAdd(DateAdd(_firstDayOfMonth, 1, TimeUnit.Months), -1, TimeUnit.Days));
    Set(_minDate, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days));
    Set(_maxDate, DateAdd(DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days), 40, TimeUnit.Days));

     

    Your code was missing:

    • A closing bracket after _dateSelected variable for the Day function
    • An extra DateAdd( Function in both the _lastDayOfMonth and _MaxDate variable

     

    Please tick Accept as solution if the answer is useful.

    Thanks,

    @AARON_C 

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 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard