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 / how to filter table ba...
Power Apps
Unanswered

how to filter table based on date selection

(0) ShareShare
ReportReport
Posted on by

Hi all,

I have a "DataTable" that reads from a SP and it contain a column Called "Date" with the type of a "Date" i want to filter this DataTable based on the range of a date in a DatePicker

 

the user can choose and then the DataTable shows only the data in the date the user chose in the DatePicker 

 

Please Help 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    I hope I can help you. 

     

    In PowerApps is a date picker available. 
    In the DataTable where the items should be shown. You can filter the items like this

     

    filter(‘sp list’, Date = DatePicker.selected.Date)


    In theory it should after selecting a date only show the items with that date.

    I’ve you have any questions please let me know.

     

     

    kind regards 

  • MostafaGamal Profile Picture
    on at

    Hi,

    I use the code you provide and it didnt work 

     

    MostafaGamal_0-1623878125713.png

     

     

     

  • v-albai-msft Profile Picture
    on at

    Hi @MostafaGamal ,

    Have you selected a correct date(existing in your list)?

    Can you provide some screenshots your formula using in the DataTable?

    I agree with @Anonymous's view, but I am not sure why this doesn't work for you.

    I did a test on my side based on your requirement, and everything works fine.

    1. Here is my DataTable1 populated from a SP list called "list10" with a Date column called "BoardDate":

    valbaimsft_1-1623897918489.png

    2. For helping you find the difference more clearly, I add a second DataTable, and set its Items property to:

    Filter(list10,BoardDate=DatePicker1.SelectedDate)

    valbaimsft_2-1623898051091.png

    Compare with my steps and check if there is any difference with your step.

    Let us know if you still have issue.

    Best regards,

    Allen

  • MostafaGamal Profile Picture
    on at

    Thanks, it works 

    but i want to the DatePicker to be a range of date not a one day

    Example from 15 June to 17 June 

    but the date picker give me only the option to choose one day 

  • Community Power Platform Member Profile Picture
    on at

    @MostafaGamal 

    I think at this moment the only option is to make 2 Datepickers.

    @v-albai-msft Do you have any further ideas to select 2 dates in 1 datepicker without making it unnecessary complex?

     

    Your filter formula might be something like this: 

     

    Filter('list', DateTime => Datepicker1.Selected.Date And  DateTime <= Datepicker1.Selected.Date)

     

    Kind regards

  • Verified answer
    v-albai-msft Profile Picture
    on at

    Hi @MostafaGamal ,

    Still agree with @Anonymous this time. I always use two date picker controls to select a date range. This is not complex in my opinion.

    If you Insist on using one date picker, I think you need to use two variables to help you. Something like below, you must click buttons to make the selected date into the specified variable. Then on your gallery, formula should be:

    Filter(list,Date>=StartVariable && Date<EndVariable )

    valbaimsft_0-1623978173599.png

     

    Using two variables to keep date may be redundant for me, so I would recommend you to use two date picker as @Anonymous suggested. 

    Filter('list', DateColumn1 => Datepicker1.Selected.Date && DateColumn1 <= Datepicker2.Selected.Date)

    Best regards,

    Allen

     

  • MostafaGamal Profile Picture
    on at

    thanks so much, I have another question 

    How i can extract the data in the from the table as an Excel file ? 

  • v-albai-msft Profile Picture
    on at

    Hi @MostafaGamal ,

    Do you mean you want to save the filtered data into a Excel file?

    If yes, you may consider to create views in SP side, and directly save the filtered SP view.

    Best regards,

    Allen

  • MostafaGamal Profile Picture
    on at

    Yes that what i want 

    How to make views in SP ?

  • v-albai-msft Profile Picture
    on at

    Hi @MostafaGamal ,

    Well, you can refer to this article, the step is easy for understanding:

    https://techcommunity.microsoft.com/t5/sharepoint/filter-and-export-a-list-view/m-p/1581316 

    Best regards,

    Allen

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard