Hi!
I have two galleries on a screen with a small form. The form will be used in the field and the user wants to be able to see previous readings while in the field taking that week's readings. The first gallery works based on a dropdown selected location, this one works fine. For the second gallery, I'm trying to get it to show all locations but Filtered by the date selected in the date picker, 30 days before the day of the reading. The data source is currently a SharePoint list. The column in question is a Date/Time column.
This is what I have in the Items property of Gallery 2.
Filter(SharePointList,columnnameDate=DateAdd(DateValue1dropdown.SelectedDate,-30,Days))
The one issue I have had is that I renamed the Date column in SharePoint to SampleDate but the URL still contains Date as the column name. So I have tried 'SampleDate' and Date and neither works.
I've also tried this:
SortByColumns(Filter(SharePointList,column nameDate=DateAdd(DateValue1dropdown.SelectedDate,-30,Days)),"Date",Descending)
The gallery is just blank. If I try just the SortbyColumns, the gallery is populated but only with the most recent entries that is not dictated by the date in the dropdown.
I've tried solutions from the following post without success:
https://powerusers.microsoft.com/t5/Building-Power-Apps/Filter-gallery-by-date/m-p/668261#M213197
I've watched this YouTube video from Reza Dorrani without success as well.
https://www.youtube.com/watch?v=eCMuXPI1Qok
It feels like such a simple solution so it's quite frustrating that I can't seem to find it.
Thank you!
Linda
Solved! Go to Solution.
@Anonymous
Your filter is very specific. It is stating that ONLY rows that have a date that is equal to the selected date minus 30 days. So that will give you only those rows - if any.
Is this what you want? Are your records that specific to the date?
If it is that you want records that are OLDER than 30 days, then change your formula to the following:
SortByColumns(
Filter(SharePointList,
SampleDate <= DateAdd(DateValue1dropdown.SelectedDate,-30,Days)
),
"Date",
Descending
)
Note: when you change the name of a column in SharePoint it never changes that internal name of the column. It will always be the same name. When you change the name, you're just changing the display name of the column.
Most, but not all, functions in PowerApps will honor the display name. Filter will. SortByColumns will not.
So, for the column name in the Filter, you can use the real name (the internal name) or the renamed display name. For the SortByColumns, you'll need to specify the real internal name.
So in the above formula, it is filtering and sorting by the same column as it should.
I hope this is helpful for you.
@Anonymous
Your filter is very specific. It is stating that ONLY rows that have a date that is equal to the selected date minus 30 days. So that will give you only those rows - if any.
Is this what you want? Are your records that specific to the date?
If it is that you want records that are OLDER than 30 days, then change your formula to the following:
SortByColumns(
Filter(SharePointList,
SampleDate <= DateAdd(DateValue1dropdown.SelectedDate,-30,Days)
),
"Date",
Descending
)
Note: when you change the name of a column in SharePoint it never changes that internal name of the column. It will always be the same name. When you change the name, you're just changing the display name of the column.
Most, but not all, functions in PowerApps will honor the display name. Filter will. SortByColumns will not.
So, for the column name in the Filter, you can use the real name (the internal name) or the renamed display name. For the SortByColumns, you'll need to specify the real internal name.
So in the above formula, it is filtering and sorting by the same column as it should.
I hope this is helpful for you.
@RandyHayes Thank you so much! I knew it was going to be something small that I was missing. I am looking for records from the date selected up to 30 days in the past. I just changed the <= to >= and it works perfectly.
Thank you for explaining the SharePoint column name vs. PowerApps name. It's very helpful.
@Anonymous
Ah got ya....so within the past 30 days. Yes, you chose the right operator then.
Happy to help and explain things.
User | Count |
---|---|
246 | |
105 | |
82 | |
50 | |
43 |