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
Solved! Go to Solution.
Hi @MostafaGamal ,
Still agree with @JacoDeRooij 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 )
Using two variables to keep date may be redundant for me, so I would recommend you to use two date picker as @JacoDeRooij suggested.
Filter('list', DateColumn1 => Datepicker1.Selected.Date && DateColumn1 <= Datepicker2.Selected.Date)
Best regards,
Allen
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
Hi,
I use the code you provide and it didnt work
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 @JacoDeRooij'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":
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)
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
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
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
Hi @MostafaGamal ,
Still agree with @JacoDeRooij 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 )
Using two variables to keep date may be redundant for me, so I would recommend you to use two date picker as @JacoDeRooij suggested.
Filter('list', DateColumn1 => Datepicker1.Selected.Date && DateColumn1 <= Datepicker2.Selected.Date)
Best regards,
Allen
thanks so much, I have another question
How i can extract the data in the from the table as an Excel file ?
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
Yes that what i want
How to make views in SP ?
User | Count |
---|---|
161 | |
86 | |
68 | |
63 | |
62 |
User | Count |
---|---|
212 | |
146 | |
93 | |
81 | |
68 |