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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Showing only today's a...
Power Apps
Answered

Showing only today's appointments in gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Good Afternoon! Y'all. So, I have this app that is taking data from a sharepoint list (Appointments) and displays appointments that are checking in and checked out. All I want to do is to show only the present day/Current day appointments. How can I achieve that?
Here is my App OnStart code:

//ClearCollect(colAppointmentsWithoutRN,Filter(Appointments, DateValue('Appointment Day and time') = Now()));

//ClearCollect(colAppointmentsWithoutRN,Appointments);

ClearCollect(
colAppointmentsWithoutRN,
Appointments
);
ClearCollect(
colAppointments,
ForAll(
Sequence(CountRows(colAppointmentsWithoutRN)),
Patch(
Last(
FirstN(
colAppointmentsWithoutRN,
Value
)
),
{RowNumber: Value}
)
)
);
Set(
varRowsPerPage,
6
);
Set(
varCurrentPage,
1
);
Set(
varTotalPages,
RoundUp(
IfError(CountRows(colAppointments) / varRowsPerPage,0),
0
)
);
Set(
isTimerStart,
true
);
Set(
varStartTimer,
true
);

// Gallery Code Ends here

Set(
varDistVARep,
Distinct(
colAppointments,
'VA Representative'
)
);
ClearCollect(
colAppointmentsWithDiff,
AddColumns(
colAppointments,
"TimeDifference",
DateDiff(
'Check-in time',
'Checkout time',
TimeUnit.Minutes
)
)
);
Set(varTotalTimeDifference, Sum(colAppointmentsWithDiff, TimeDifference));
Set(
varTotalRep,
CountRows(varDistVARep)
);
Set(
varTotalAppointments,
CountRows(colAppointments)
);
Set(
varTotalCheckIn,
CountRows(
Filter(
colAppointments,
Status.Value = "Checked-in"
)
)
);
Set(
varTotalCheckOut,
CountRows(
Filter(
colAppointments,
Status.Value = "Checked-out"
)
)
);

Set(
varCheckInPercent,
IfError((varTotalCheckIn / varTotalAppointments),0) * 100 & " %"
);
Set(
varCheckOutPercent,
IfError((varTotalCheckOut / varTotalAppointments),0) * 100 & " %"
);

Clear(colPiCharData);
Collect(
colPiCharData,
{
Status: "Check In",
Count: varTotalCheckIn
}
);
Collect(
colPiCharData,
{
Status: "Check Out",
Count: varTotalCheckOut
}
);

 

And here is the gallery items property code:

Filter(
colAppointments,
RowNumber <= (varRowsPerPage * varCurrentPage) && RowNumber > (varRowsPerPage * varCurrentPage) - varRowsPerPage)

 

Categories:
  • M_Ali_SZ365 Profile Picture
    1,110 on at

    Hi @Anonymous ,

    First, we need to filter the appointments to include only the ones for today. Replace your existing ClearCollect for colAppointmentsWithoutRN with the following line:

     

    ClearCollect(colAppointmentsWithoutRN, Filter(Appointments, Text('Appointment Day and time', "yyyy-mm-dd") = Text(Today(), "yyyy-mm-dd")));

     

    This line filters your Appointments list to keep only the entries where the date matches today's date.

    1. Then, the rest of your app setup code can stay the same. This ensures that the gallery will now only show appointments for the current day.

    For the gallery items property, no change is needed because it's already set up to show the items based on the colAppointments collection, which we've just filtered for today's appointments.

    Remember to replace 'Appointment Day and time' with the exact name of your date column from the SharePoint list. The formatting should match so that the comparison works correctly.

    And that's it! Your gallery should now display only the appointments scheduled for today.

    Please accept this solution if it resolves the issue. ✅
    Best regards,
    Muhammad Ali

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Did'nt work man.

  • Verified answer
    M_Ali_SZ365 Profile Picture
    1,110 on at

    Hey @Anonymous 

    I see you're having trouble filtering your appointments to show only those for today. Let’s tweak the filter formula a bit:

    In your app's OnStart code, where you collect the appointments, use this line instead:

    ClearCollect(colAppointmentsWithoutRN, Filter(Appointments, Text('Appointment Day and time', "yyyy-MM-dd") = Text(Today(), "yyyy-MM-dd")));

    What this does is it compares only the date part of your 'Appointment Day and time' with today’s date. Make sure that 'Appointment Day and time' is the exact name of your date field in SharePoint.

    No changes are needed in the gallery's item property – it should work with the updated collection.

    Give this a try and let's see if it shows only today's appointments now.

    Please accept this solution if it resolves the issue. ✅
    Best regards,
    Muhammad Ali

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    It worked man. Thanks for the help.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard