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

Filter data by current week

Hi,

 

I am trying to retrieve only items in my gallery by current week. I have a column [DateStart] and e column [DateEnd]. I also have a calculated column [calcWeekStart] and [calcWeekEnd] which shows the Sunday (first day of the week) in which the [DateStart] falls and shows the Saturday (last day of the week) in which the [DateEnd] falls. If either of those dates are in the current week it should show up in the gallery.

 

Filter(WorkOrders, calcWeekStart <= Today() And calcWeekEnd >= Today())

 

In a SharePoint list I use something similar to give me a view by current week. But I can't get this to work in powerapps.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @pketeldijk ,

Two things, you have your greater than > and less then < the wrong way around, but you do not need date pickers - if you want Monday as the start of the week (the default is Sunday), this formula should do it for you.

Filter(
   WorkOrders, 
   DateStart>=Today()-Weekday(Today())+2 &&
   DateEnd<=Today()+(9-Weekday(Today()))
)

 

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.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User III
Super User III

Hi @pketeldijk ,

You cannot filter by SharePoint calculated columns (as you have discovered).

I have not seen your formula, but the Weekday function in Power Apps should allow you to set Variables to test the date on.

Happy to assist further with relevant details provided.

 

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.

@WarrenBelz ,

 

I am this far that I can get the default date of  DatePicker1 to the current Monday and DatePicker2 to the Sunday of that same week.

 

I am using the following code in the gallery. But I must be doing something wrong because it only shows me 1 item (it should be about 15). 

 

 

Filter(WorkOrders, StartDate <= DatePicker1.SelectedDate And EndDate >= DatePicker2.SelectedDate)

 

 

 

If the StartDate or EndDate of a job fall in or between the current week it must display the items.

Hi @pketeldijk ,

Two things, you have your greater than > and less then < the wrong way around, but you do not need date pickers - if you want Monday as the start of the week (the default is Sunday), this formula should do it for you.

Filter(
   WorkOrders, 
   DateStart>=Today()-Weekday(Today())+2 &&
   DateEnd<=Today()+(9-Weekday(Today()))
)

 

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.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (29,492)