Hi There,
I have the following code. The code highlighted in orange is supposed to return the Monday of the most current week (i.e. if today is 4/4, it should pull 3/29. It continues to return 4/1.
Any help would be greatly appreciated.
Code:
Concurrent(
Set(currentUser,User()),
Set(currentMonday,
DateAdd(
Today(),(Weekday(Today(),Monday)-1)*-1,Days)),
Set(
weeksList,ForAll(Sequence(20,Day(DateAdd(Today(),-1 * (Weekday(Today(),Monday) - 1),Days)) - 28,7),Date(Year(Today()),Month(Today()),Value))));
Solved! Go to Solution.
Hi @Anonymous :
I think this formula is fine, and it should work normally.
Set(currentMonday,
DateAdd(
Today(),(Weekday(Today(),Monday)-1)*-1,Days))
I suggest you check if there is a problem with the settings of the weekslist. I have already replied to your other thread on this issue.
Dropdown List showing "Week of"
Best Regards,
Bof
Hi @Anonymous :
I've made a test but it worked well on my side:
Button-OnSelect
Concurrent(
Set(
currentUser,
User()
),
Set(
currentMonday,
DateAdd(
Today(),-1 * (Weekday(Today(),Monday) - 1),Days)
),
Set(
weeksList,
ForAll(
Sequence(20,0,1),
DateAdd(Today(),-1 * (Weekday(Today(),Monday) - 1)+Value*7-28,Days)
))
);
Combo box-Items
AddColumns(
weeksList,
"WeekEnd",
DateAdd(
Value,
6,
Days
),
"Week Display",
Value & " to " & DateAdd(
Value,
6,
Days
)
)
Best Regards,
Bof
Hi @Anonymous :
I think this formula is fine, and it should work normally.
Set(currentMonday,
DateAdd(
Today(),(Weekday(Today(),Monday)-1)*-1,Days))
I suggest you check if there is a problem with the settings of the weekslist. I have already replied to your other thread on this issue.
Dropdown List showing "Week of"
Best Regards,
Bof
Hi @v-bofeng-msft - can you explain what you mean by checking the settings of the weekslist? I'm unsure where to check this. I'm still running into the same issue for this month, as my current code is now showing that June 3rd is a Monday (which actually is a Thursday). The code in my other post (https://powerusers.microsoft.com/t5/Building-Power-Apps/Dropdown-List-showing-quot-Week-of-quot/td-p...) doesn't work for me. Any help would be greatly appreciated!
Hi @Anonymous :
I've made a test but it worked well on my side:
Button-OnSelect
Concurrent(
Set(
currentUser,
User()
),
Set(
currentMonday,
DateAdd(
Today(),-1 * (Weekday(Today(),Monday) - 1),Days)
),
Set(
weeksList,
ForAll(
Sequence(20,0,1),
DateAdd(Today(),-1 * (Weekday(Today(),Monday) - 1)+Value*7-28,Days)
))
);
Combo box-Items
AddColumns(
weeksList,
"WeekEnd",
DateAdd(
Value,
6,
Days
),
"Week Display",
Value & " to " & DateAdd(
Value,
6,
Days
)
)
Best Regards,
Bof
Thanks @v-bofeng-msft - where I'm running into an issue is that my drop-down list should default to the current week (i.e. 5/31-6/6). The "-28" within the code should then show me the last four weeks in that drop-down (going as far back as 5/3-5/9). The purpose of this is to allow my colleagues to make an input if they forgot to enter their information. Based on your video above, I don't see that it's defaulting to the current week and showing the previous four weeks and the subsequent number of works (per the sequence function) after the current week...
Very much appreciate all your help with this!
Hi @v-bofeng-msft - your Concurrent formula worked. The only change I had to make was adding a space after "value" and also changed 28 to 35 (to show the previous 5 weeks). I also toggled between the drop-down for "value", as I changed it from "value" back to "Week Display". Now all is working. Thanks again for all the help!
User | Count |
---|---|
121 | |
87 | |
87 | |
75 | |
66 |
User | Count |
---|---|
215 | |
180 | |
138 | |
96 | |
82 |