Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Courtb86
Frequent Visitor

Leap Year - Previous Month

I have a calendar and its not showing dates from 02/29 and I feel really dumb asking this but can someone look at my code and let me know how to fix this?

 

Calendar =
VAR BaseCalendar =
CALENDAR("01/01/2023", "12/31/2040")
RETURN
GENERATE (
BaseCalendar,
VAR BaseDate = [Date]
VAR DayNum = WEEKDAY(BaseDate, 1)
VAR DayDate = DAY(BaseDate)
VAR WeekDate = WEEKDAY(BaseDate, 1)
VAR YearDate = YEAR(BaseDate)
VAR MonthNumber = MONTH ( BaseDate )
VAR MonthName = FORMAT ( BaseDate, "mmmm" )
VAR MonthYear = CONCATENATE(CONCATENATE(MonthName, ", "), YearDate)
VAR CurrentYear = IF( YearDate = YEAR(TODAY()), "TRUE", "FALSE")
VAR PrevMonth = IF(MonthNumber = MONTH(TODAY())-1, "TRUE", "FALSE")
VAR LatestMonth = IF(CurrentYear = "TRUE" && PrevMonth = "TRUE", "Previous Month", MonthName)
RETURN ROW (
"Day", DayDate,
"DayNum", DayNum,
"WeekDate", WeekDate,
"Year", YearDate,
"Month Number", MonthNumber,
"Month", MonthName,
"MonthYear", MonthYear,
"PreviousMonth", PrevMonth,
"CurrentYear", CurrentYear,
"Previous Month", LatestMonth
)
)
1 ACCEPTED SOLUTION
JamesFR06
Resolver IV
Resolver IV

Hello

 

I've tried your code on my pc and no error and last date is 31/12/2040

View solution in original post

3 REPLIES 3
JamesFR06
Resolver IV
Resolver IV

uld be inside datas or not. WHen you asked to genrate to this date to this one, for me he is not taking care of datas

JamesFR06
Resolver IV
Resolver IV

Hello

 

I've tried your code on my pc and no error and last date is 31/12/2040

Weird because the relationships I have are not showing 02/29/2024 that I know has data within them. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.