cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Filter a Gallery of Outlook Calendar Items to Show only AM Records

For reference:

_dateSelected is Type of Text and hold "1/18/2021 12:00 AM"

MyCalendarEvents hold Events for the entire current day.

 

 originally, I had Gallery Items set to:

 

SortByColumns(MyCalendarEvents, "Start")

 

And this displays the events of the day correctly

 

Then I tried

 

SortByColumns(Filter(MyCalendarEvents, End < DateTimeValue(Text(_dateSelected, DateTimeFormat.ShortDate) & " 12:00 PM"), DateTimeFormat.ShortTime), "Start")

 

and then

 

SortByColumns(Filter(MyCalendarEvents, DateDiff(End, DateTimeValue(Text(_dateSelected, DateTimeFormat.ShortDate) & " 12:00 PM")) < 0, DateTimeFormat.ShortTime), "Start")

 

 

and it does not display any records. Thanks for considering

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hi @cycle4passion ,

Following your formula, I tend to think that you want to filter the sessions that end until 12:00 PM on current day.
So if my supposition is correct, your formula needs a small corection as End value from MyCalendarEvents collection is a dateTimeValue, like this:
SortByColumns(Filter(MyCalendarEvents, End < DateTimeValue(Text(_dateSelected, DateTimeFormat.ShortDate) & " 12:00 PM")), "Start")


Actually, I'm quite sure that:

DateTimeValue(Text(_dateSelected, DateTimeFormat.ShortDate) & " 12:00 PM"), DateTimeFormat.ShortTime)

does not retrive a  value. You can put this formula inside a text property of a label control to see the real value (i think that you get a empty string).  

 

Hope it helps !

View solution in original post

3 REPLIES 3
Helper II
Helper II

...

Super User III
Super User III

HI @cycle4passion ,

Assuming your _dateselected is Text, it would be something like this

SortByColumns(
   Filter(
      MyCalendarEvents, 
      End <
      DateAdd(
         DateValue(_dateSelected),
         1,
         Days
      ) &&
      Start >
      DateValue(_dateSelected)
   )
)

If it actually a Date value, this might do it

SortByColumns(
   Filter(
      MyCalendarEvents, 
      End <
      DateAdd(
         _dateSelected,
         1,
         Days
       ) &&
      Start >
      _dateSelected
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Super User II
Super User II

Hi @cycle4passion ,

Following your formula, I tend to think that you want to filter the sessions that end until 12:00 PM on current day.
So if my supposition is correct, your formula needs a small corection as End value from MyCalendarEvents collection is a dateTimeValue, like this:
SortByColumns(Filter(MyCalendarEvents, End < DateTimeValue(Text(_dateSelected, DateTimeFormat.ShortDate) & " 12:00 PM")), "Start")


Actually, I'm quite sure that:

DateTimeValue(Text(_dateSelected, DateTimeFormat.ShortDate) & " 12:00 PM"), DateTimeFormat.ShortTime)

does not retrive a  value. You can put this formula inside a text property of a label control to see the real value (i think that you get a empty string).  

 

Hope it helps !

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (74,481)