Forum Discussion
Create a Calendar Year Visual
Hello,
Asking for help creating a calendar visual in PBI that displays a whole year at a time. Wanting to be able to change the color of the day depending on a true or false value.
Something like this:
I tried some examples like this one https://medium.com/microsoft-power-bi/calendar-heatmap-visual-in-power-bi-a-macgyvered-approach-1796c062cddf but I couldn't get my visual to work like in the example.
Any help would be appreciated.
Thanks,
Tim
Try the approach in the attached pbix.
8 Replies
- danextianSuper User
- Shahid12523Community Champion
- Create a calendar table in DAX with columns for date, weekday, week number, and a TRUE/FALSE flag.
- Use a matrix visual: rows = week number, columns = weekday name, values = day number.
- Apply conditional formatting to color days based on the TRUE/FALSE flag.
This gives you a full-year calendar view with dynamic coloring.Create a Calendar Table
Calendar =
ADDCOLUMNS (
CALENDAR (DATE(2025,1,1), DATE(2025,12,31)),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMMM"),
"MonthNum", MONTH([Date]),
"Day", DAY([Date]),
"Weekday", WEEKDAY([Date], 2), -- 2 = Monday start
"WeekdayName", FORMAT([Date], "DDD"),
"WeekNum", WEEKNUM([Date], 2),
"IsFlagged", [YourLogicHere] -- Replace with your TRUE/FALSE logic
)Build the Matrix Visual
Use a matrix to simulate the calendar grid:
- Rows: WeekNum
- Columns: WeekdayName
- Values: Use a measure like this:DayLabel =
IF (
SELECTEDVALUE('Calendar'[IsFlagged]),
FORMAT(SELECTEDVALUE('Calendar'[Day]), "00"),
BLANK()
)Conditional Formatting
Apply color rules to highlight flagged days:
- Go to the matrix visual → Format → Conditional Formatting → Background color.
- Use a measure like:
DayColor =
SWITCH (
TRUE(),
SELECTEDVALUE('Calendar'[IsFlagged]) = TRUE(), "#FF9999", // Red for flagged
"#FFFFFF" // White for normal
)- danextianSuper User
So how is OP exactly going to comparmentalize each month? Care to share a sample pbix?
- v-nmadadi-msftCommunity Support
Hi bigmac025
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you. - v-nmadadi-msftCommunity Support
Hi bigmac025
May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.
Thank you - v-nmadadi-msftCommunity Support
Hi bigmac025
As we haven’t heard back from you, we wanted to kindly follow up to check if the suggestions provided by the community members for the issue worked. Please feel free to contact us if you have any further questions.
Thanks and regards