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 / Achieving fiscal year ...
Power Apps
Answered

Achieving fiscal year using datepicker

(0) ShareShare
ReportReport
Posted on by 320

Hi Team,

I have a situation in which i need to enable / disable text input controls depending on the date from datepicker.

 

I have 12 text inputs and a datepicker.

The text inputs expect are according to the 12 months (Jul, Aug, Sep, Oct, ...., Jun)

Now if the month selected in date picker is Aug, then i want my text input for July to be disable.

If December is month selected, the text inputs for Jul, Aug, Sep, Oct, Nov should be disabled.

When i select Jun, all controls except one for Jul should be disabled, I want to achieve this for a fiscal year (Jul 2018 - Jun 2019)

How can i pull this off?

 

Thanks

Categories:
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    You'll need to update the DisplayMode property for all individual text input controls, with minor tweaks in the formula for each one.

    For the months 1-6 (Jan-Jun), you need to disable the control if the month of the selected date is past that month and it's less than July (otherwise it would be in the next fiscal year). Notice that the expression for June will always evaluate to DisplayMode.Edit (since no integer value can be both greater than 6 and smaller than 7), so you could use that, but I like the consistency.

    Jan: If(Month(DatePicker1.SelectedDate) > 1 And Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Feb: If(Month(DatePicker1.SelectedDate) > 2 And Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Mar: If(Month(DatePicker1.SelectedDate) > 3 And Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Apr: If(Month(DatePicker1.SelectedDate) > 4 And Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    May: If(Month(DatePicker1.SelectedDate) > 5 And Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Jun: If(Month(DatePicker1.SelectedDate) > 6 And Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)

    For the months 7-12 (Jul-Dec), you would disable the control if the month is less than June or if it's past the selected date. Again, notice that the expression for July could be simplified to 'Month(DatePicker1.SelectedDate) = 7' and for December as 'Month(DatePicker1.SelectedDate) < 7' (since there's no month greater than 12), but again, for consistency I prefer to keep the same expression as the other months.

    Jul: If(Month(DatePicker1.SelectedDate) > 7 Or Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Aug: If(Month(DatePicker1.SelectedDate) > 8 Or Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Sep: If(Month(DatePicker1.SelectedDate) > 9 Or Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Oct: If(Month(DatePicker1.SelectedDate) > 10 Or Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Nov: If(Month(DatePicker1.SelectedDate) > 11 Or Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)
    Dec: If(Month(DatePicker1.SelectedDate) > 12 Or Month(DatePicker1.SelectedDate) < 7, DisplayMode.Disabled, DisplayMode.Edit)

    The attached app shows those expressions in a real app. Hope this helps!

  • abd3127 Profile Picture
    320 on at

    Thanks @CarlosFigueira

    This solution works like a charm!!

     

     

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

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard