🎯 Objective
Build a dynamic 12-month calendar (January to December) in Power Apps that:
Automatically generates dates
Displays all months in a structured layout
Highlights today’s date, weekends, and special events
Introduction
In many business applications, calendars play a crucial role—whether it's for attendance tracking, booking systems, or event management.
However, Power Apps does not provide a built-in full-year calendar component. Developers often struggle with:
In this article, we’ll build a fully dynamic and scalable Year Calendar using formulas and collections.
Step 1: Create Year Selector
Add a variable to control the selected year.
App → OnStart
Set(varYear, Year(Today()))
👉 This sets the default year to the current year.
Step 2: Create Months Collection
Generate all 12 months dynamically.
ClearCollect(
colMonths,
ForAll(
Sequence(12),
{
MonthNumber: Value,
MonthName: Text(Date(varYear, Value, 1), "[$-en-US]mmmm")
}
)
)
👉 This creates a collection with:
Step 3: Create Calendar Dates Collection
Now generate all dates for the selected year.
ClearCollect(
colDates,
ForAll(
Sequence(
DateDiff(Date(varYear, 1, 1), Date(varYear, 12, 31)) + 1
),
{
FullDate: DateAdd(Date(varYear, 1, 1), Value - 1),
Year: Year(DateAdd(Date(varYear, 1, 1), Value - 1)),
Month: Month(DateAdd(Date(varYear, 1, 1), Value - 1)),
Day: Day(DateAdd(Date(varYear, 1, 1), Value - 1)),
Weekday: Weekday(DateAdd(Date(varYear, 1, 1), Value - 1))
}
)
)
👉 This generates 365/366 records dynamically.
Step 4: Create UI Layout (Gallery Structure)
Parent Gallery (Months)
colMonths
👉 This will display all 12 months.
Child Gallery (Dates inside each Month)
Inside the month gallery, add another gallery.
Filter(colDates, Month = ThisItem.MonthNumber)
👉 This filters dates for each month.
Step 5: Display Dates in Grid Format
To show dates like a calendar:
👉 This automatically creates a calendar grid layout.
Step 6: Highlight Today’s Date
Set TemplateFill of date gallery:
If(
ThisItem.FullDate = Today(),
RGBA(0, 120, 212, 0.3),
Color.Transparent
)
Step 7: Highlight Weekends
If(
ThisItem.Weekday = 1 || ThisItem.Weekday = 7,
RGBA(255, 0, 0, 0.1),
Color.Transparent
)
👉 Sunday = 1, Saturday = 7
Step 8: Highlight Events (Optional)
If you have a SharePoint list like:
EventsList
Use:
If(
!IsBlank(
LookUp(EventsList, EventDate = ThisItem.FullDate)
),
RGBA(0, 200, 0, 0.3),
Color.Transparent
)
Step 9: Combine All Highlights
If(
ThisItem.FullDate = Today(),
RGBA(0, 120, 212, 0.3),
If(
ThisItem.Weekday = 1 || ThisItem.Weekday = 7,
RGBA(255, 0, 0, 0.1),
If(
!IsBlank(LookUp(EventsList, EventDate = ThisItem.FullDate)),
RGBA(0, 200, 0, 0.3),
Color.Transparent
)
)
)
Step 10: Year Navigation (Optional)
Add buttons:
Next Year
Set(varYear, varYear + 1)
Previous Year
Set(varYear, varYear - 1)
👉 Re-run collections after changing year.
Performance Best Practices
✔ Use collections instead of repeated calculations
✔ Avoid recalculating dates inside galleries
✔ Keep formulas simple and readable
✔ Use variables for year control
Before vs After Implementation
Scenario: Static calendar
Result: Limited & hardcoded
Scenario: No collections
Result: Slow performance
Scenario: Dynamic collections
Result: Fast & scalable
Scenario: Full year calendar
Result: Professional UI
Output
After implementation:
Dynamic 12-month calendar
Automatic date generation
Today highlighting
Weekend highlighting
Event integration support
Conclusion
Building a full-year calendar in Power Apps may seem complex, but with the right approach:
Use Sequence() for dynamic data
Use collections for performance
Use nested galleries for layout
This approach helps you build scalable, reusable, and enterprise-ready calendar solutions.