Hello there,
I have a gallery in which I want to Filter that the current week is shown and all other weeks that follow.
Currently I just filter with Filter(Source; Datum >= Today()-3) and that works for most of the days but is not really the solution I'm looking for because it will hide Monday when it's Friday. It's a bit an ugly solution and my client would like to see it fixed. Can you guys help me?
1. How can I Filter that the view only shows entries from this current week (starting on Monday's)?
2. Bonus question: How can I make this resiliant enough so it accepts missing Mondays (like not filled in holidays/weekends)?
Thanks in advance!
Solved! Go to Solution.
Hi @Leone ,
Do you use Monday as the first day within a week?
Do you want to filter your records within current week (Monday through Sunday)?
If you use Monday as the first day within a week, and you want to filter your records within current week (Monday through Sunday), please consider take a try with the following formula (set the Items property of Gallery to following😞
Filter(
Source;
Datum >= DateAdd(Today(); -Weekday(Today(); StartOfWeek.Monday)+1);
Datum <= DateAdd(Today(); 7-Weekday(Today(); StartOfWeek.Monday))
)
The following formula is used to get the first day (Monday) of current week:
DateAdd(Today(); -Weekday(Today(); StartOfWeek.Monday)+1)
The following formula is used to get the last day (Sunday) of current week:
DateAdd(Today(); 7-Weekday(Today(); StartOfWeek.Monday))
If you use Sunday as the first day, you need to modify above Filter formula as below:
Filter(
Source;
Datum >= DateAdd(Today(); -Weekday(Today())+1);
Datum <= DateAdd(Today(); 7-Weekday(Today()))
)
For your second Bonus question, if you want to exclude the holidays/weekends from above current week days (Monday to Sunday), please check and see if the following blog would help in your scenario:
Best regards,
What is your data source?
The filter function in your example is non-delegable, so is it safe to assume that delegation is not an issue here?
Either way, set a variable for the Date you are trying to filter from.
Set (
gblDateFromFilter,
Today() - Weekday(
Today(),
MondayZero
)
)
That utilizes the Weekday function to determine the Monday for the given week.
Hi @Leone ,
Do you use Monday as the first day within a week?
Do you want to filter your records within current week (Monday through Sunday)?
If you use Monday as the first day within a week, and you want to filter your records within current week (Monday through Sunday), please consider take a try with the following formula (set the Items property of Gallery to following😞
Filter(
Source;
Datum >= DateAdd(Today(); -Weekday(Today(); StartOfWeek.Monday)+1);
Datum <= DateAdd(Today(); 7-Weekday(Today(); StartOfWeek.Monday))
)
The following formula is used to get the first day (Monday) of current week:
DateAdd(Today(); -Weekday(Today(); StartOfWeek.Monday)+1)
The following formula is used to get the last day (Sunday) of current week:
DateAdd(Today(); 7-Weekday(Today(); StartOfWeek.Monday))
If you use Sunday as the first day, you need to modify above Filter formula as below:
Filter(
Source;
Datum >= DateAdd(Today(); -Weekday(Today())+1);
Datum <= DateAdd(Today(); 7-Weekday(Today()))
)
For your second Bonus question, if you want to exclude the holidays/weekends from above current week days (Monday to Sunday), please check and see if the following blog would help in your scenario:
Best regards,
Thank you both, I will try this out!
User | Count |
---|---|
258 | |
111 | |
95 | |
48 | |
41 |