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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Select a range of date...
Power Apps
Answered

Select a range of dates in date picker

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I'm trying to sort my data in a range of dates in the date picker. For example being able to select 7/4/21 and select 7/26/21 and get any data that was entered in that time period. And/or being able to have a clickable options like "Last Week" "Last month" "Last 3 months"

 

I'm a beginner so please explain it in detail 🙂

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    I did a simple demo for you.

    1\ This is my datasource.

    vxiaochenmsft_0-1627610212668.png

     

    2\ Add 2 datepicker control 'DatePicker1' and 'DatePicker2'.

    Add a gallery control and set its Items property to:

    Filter(LIST148,Date_Column>=DatePicker1.SelectedDate&&Date_Column<=DatePicker2.SelectedDate)

    vxiaochenmsft_1-1627610369952.png

     

    3\ Add a button control and set its onselect property to:

    Set(Last_Week_End,DateAdd(Today(),-Weekday(Today()),Days));Set(Last_Week_Start,DateAdd(Today(),-Weekday(Today())-6,Days))

    //Create 2 variables

     

    Set gallery's Items property to:

    Filter(LIST148,Date_Column>=Last_Week_Start&&Date_Column<=Last_Week_End)

    // Show last week 

    vxiaochenmsft_2-1627610869604.png

     

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    With(
     {
     sData: Filter(
     'SPDataSource',
     IsBlank(FromDate.SelectedDate) || IsEmpty(FromDate.SelectedDate) || Date >= FromDate.SelectedDate,
    	 IsBlank(ToDate.SelectedDate) || IsEmpty(ToDate.SelectedDate) || Date <= ToDate.SelectedDate
     )
     }, 
    	Sort(
    		sData, Date, If(SortDesending1, Descending, Ascending)
    	) 
    
    )

     

    We can add more filters if you need them.

     

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard