cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vjnvinod
Frequent Visitor

Power apps logic for Card based on Current month

hi

 

I am using the below logic in my cards to disable them

 

If(Month(Today())<7,DisplayMode.Disabled,Parent.DisplayMode)

 and I have cards in a month like below

what basically I want to do, for instance, the current month is Jan, I want to disable the previous months in my case(July, Aug, Sep, Oct, Nov, Dec) and starting Jan to Jun, it should enable the card to enter values

 

and if my current month is Feb, then disable (July, Aug, Sep, Oct, Nov, Dec, Jan) and starting Feb to Jun, it should enable the card to enter values

and so on, as the month goes on

I was trying with the above logic (If(Month(Today())<7,DisplayMode.Disabled,Parent.DisplayMode)) but that doesn't holds good

 

any help on this is highly appreciated

 

vjnvinod_0-1641825467186.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @vjnvinod ,

A bit of a mind-bender, but I think the below will do it

January

If(
   Month(Today()) < 7,
   If(
      Month(Today() = 1,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Edit
)


February

If(
   Month(Today()) < 7,
   If(
      Month(Today() < 3,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Edit
)

March

If(
   Month(Today()) < 7,
   If(
      Month(Today() < 4,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Edit
)
 . . . . . . 
 
July
 
If(
   Month(Today()) > 6,
   If(
      Month(Today() = 7,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Disabled
)

August

If(
   Month(Today()) > 6,
   If(
      Month(Today() < 9,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Disabled
)

September

If(
   Month(Today()) > 6,
   If(
      Month(Today() < 10,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Disabled
)

 . . . . 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @vjnvinod ,

A bit of a mind-bender, but I think the below will do it

January

If(
   Month(Today()) < 7,
   If(
      Month(Today() = 1,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Edit
)


February

If(
   Month(Today()) < 7,
   If(
      Month(Today() < 3,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Edit
)

March

If(
   Month(Today()) < 7,
   If(
      Month(Today() < 4,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Edit
)
 . . . . . . 
 
July
 
If(
   Month(Today()) > 6,
   If(
      Month(Today() = 7,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Disabled
)

August

If(
   Month(Today()) > 6,
   If(
      Month(Today() < 9,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Disabled
)

September

If(
   Month(Today()) > 6,
   If(
      Month(Today() < 10,
      DisplayMode.Edit,
      DisplayMode.Disabled
   ),
   DisplayMode.Disabled
)

 . . . . 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

vjnvinod
Frequent Visitor

@WarrenBelz  awesome, thanks so much

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,956)