web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery by Cale...
Power Apps
Answered

Filter Gallery by Calendar date range

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Calendar.jpg

 

I have a calendar and a gallery on a screen in my PowerApp. The client would to be able to filter the gallery by using the date range that's in red and blue. Any suggestions?

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    What problem are you running into?

    I assume you are using the GetEventsCalendarViewV2 of the Office365 Outlook connector.  If so, you can specify the start and end dates on that formula.

     

    I hope that helps shed some light for you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes Hi Randy, I'm just not certain as to what formula I need to use for my gallery to filter it by the date range. I'm using a SharePoint calendar as my datasource. I'm not using the O365 Connector.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Ok, if it's a SharePoint list then your calendar list will have a column defined - Start Time  (which is really EventDate behind the scenes)

    So your Filter would be:

      Filter(yourDataSource, 'Start Time' >= _selectionStart && 'Start Time' <= _selectionEnd)

     

    If you have issues with the 'Start Time' not showing up, try the EventDate.

     

    Hope that helps you.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you want to filter your Gallery items (use SP Calendar list as data source) based on the Date range you selected from your Calendar?

     

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

    Set the Items property of the Gallery to following:

    Filter(
     'YourCalendarList',
     'Start Time' >= _selectionStart,
     'End Time' <= _selectionEnd
    )

    Or

    Filter(
     'YourCalendarList',
     Value(Text('Start Time', "[$-en-US]yyyymmdd")) >= Value(Text(_selectionStart, "[$-en-US]yyyymmdd")),
     Value(Text('End Time',"[$-en-US]yyyymmdd")) <= Value(Text(_selectionEnd, "[$-en-US]yyyymmdd"))
    )

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

     

    More details about Filter function in PowerApps, please check the following article:

    Filter function

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes Worked perfectly. Thanks!!

  • AndiRodi Profile Picture
    133 on at

    but this way you don't have problems with the delegation?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @AndiRodi 

    Oh most definitely you would have problems with delegation with that formula.  That was not an original concern in this post.

    If you are experiencing that problem and need some help, I would suggest starting a new post with that issue.

  • AndiRodi Profile Picture
    133 on at

    hi @RandyHayes 

     

    Thnaks for your anware.

     

    I have a big problem with Date Picker.

     

    I have a Gallery which i filter by a selctede Date from DatePicker controll. This is the cod that i seet to Items Propriety of gallery controll

    items=SortByColumns(Search(Filter(Appointments;DateValue(Text('Start Time')) = DateValue(Text(datepFilterDatePicker.SelectedDate)));TextSearchBox1.Text;"subject");"scheduledstart";If(SortDescending1;Descending;Ascending))//Filter(Appointments,DateValue(Text(Date)) = DateValue(Text(datepFilterDatePicker.SelectedDate)))

    The Text() function is stopping the delegation. Then i try to do as below

    SortByColumns(Search(Filter(Appointments;'Start Time'>datepFilterDatePicker.SelectedDate&&'Start Time'<DateAdd(datepFilterDatePicker.SelectedDate;1;Days));TextSearchBox1.Text;"subject");"scheduledstart";If(SortDescending1;Descending;Ascending))

    but knnow i geth this error.MicrosoftTeams-image.png

    Please Let me know as soon as hao i can do a workaround.

     

    Thanks

     

    Andi

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @AndiRodi 

    This would be better done through a new post rather than adding on to this post which is already solved.

     

    But, since we're here - 

    Change your Gallery Items Property to:

    SortByColumns(
    Search(
    Filter(Appointments;
    ('Start Time' >= datepFilterDatePicker.SelectedDate)
    && ('Start Time' <= DateAdd(datepFilterDatePicker.SelectedDate;1;Days))
    );
    TextSearchBox1.Text; "subject"
    );
    "scheduledstart";
    If(SortDescending1;Descending;Ascending)
    )

    If that doesn't immediately help, I would start a new post on this forum with the results you are seeing.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard