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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare 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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.