cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Prav
Level: Powered On

Drop down with 4 dates

Hi, I would like some help to set a drop down list showing 4 dates for each Monday for the current week + last 3 weeks based on Today(). I can derive the current week number for Today().

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Drop down with 4 dates

Hi @Prav ,

Could you please share a bit more about your scenario?

Do you want to show Monday for current week and last three week within a Dropdown box?

 

I have made a test on my side, please consider take a try with the following workaround:

5.JPG

 Add a Dropdown control in your app, set the Items property to following:

[
  DateAdd(Today(), -(Weekday(Today())-2)),
  DateAdd(Today(), -(Weekday(Today())-2)-7),
  DateAdd(Today(), -(Weekday(Today())-2)-7*2),
  DateAdd(Today(), -(Weekday(Today())-2)-7*3)
]

Note: I assume that you set the Sunday as first day of a week.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Drop down with 4 dates

@Prav 

I would use this code to calculate the current week's Monday

 

DateAdd(Today(),-(Weekday(Today())-2),Days)

 

We can repeat that code inside of a Dropdown box's Items property with some slight modifications to get your desired result.

 

[
    DateAdd(Today(),-(Weekday(Today())-2),Days),
    DateAdd(Today(),-(Weekday(Today())-2-7),Days),
    DateAdd(Today(),-(Weekday(Today())-2-14),Days),
    DateAdd(Today(),-(Weekday(Today())-2-21),Days)
]

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Community Support Team
Community Support Team

Re: Drop down with 4 dates

Hi @Prav ,

Could you please share a bit more about your scenario?

Do you want to show Monday for current week and last three week within a Dropdown box?

 

I have made a test on my side, please consider take a try with the following workaround:

5.JPG

 Add a Dropdown control in your app, set the Items property to following:

[
  DateAdd(Today(), -(Weekday(Today())-2)),
  DateAdd(Today(), -(Weekday(Today())-2)-7),
  DateAdd(Today(), -(Weekday(Today())-2)-7*2),
  DateAdd(Today(), -(Weekday(Today())-2)-7*3)
]

Note: I assume that you set the Sunday as first day of a week.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Prav
Level: Powered On

Re: Drop down with 4 dates

Hi @v-xida-msft / @mdevaney 
The stating week is Monday and the dates in your drop down are correct. However, today is Sunday the 17/11/2019 and the drop down is show 18/11/2019 already.

Super User
Super User

Re: Drop down with 4 dates

@Prav
Would if work if you added this condition to the end of the 2nd argument in DATEADD? It says: if the date is Sunday go back 7 days earlier

+If(Weekday(Today())=1,-7,0)

Like this:

[
DateAdd(Today(),-(Weekday(Today())-2) +If(Weekday(Today())=1,-7,0),Days),
DateAdd(Today(),-(Weekday(Today())-2-7) +If(Weekday(Today())=1,-7,0),Days),
DateAdd(Today(),-(Weekday(Today())-2-14) +If(Weekday(Today())=1,-7,0),Days),
DateAdd(Today(),-(Weekday(Today())-2-21) +If(Weekday(Today())=1,-7,0),Days)
]

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,326)