Forum Discussion

KRISH80's avatar
KRISH80
Helper II
6 years ago

Help with Calendar marking weekend

Dear All,

I have below code to generate dynamic calendar which also gives weekends and weekdays. But i don't know how to tweak this code to Mark certian dates as Holidays. For eg - 25th Dec, 1st Jan etc... can anyone help me ?

 

Calendar =
ADDCOLUMNS (
CALENDARAUTO ( 3 ),
"MIndex", MONTH ( EDATE ( [Date], -3 ) ),
"CalMonth", FORMAT ( [Date], "mmm" ),
"CalQtr", "Q"
& CEILING ( MONTH ( [Date] ), 3 ) / 3,
"CalYear", YEAR ( [Date] ),
"FinQtr", "Q"
& CEILING ( MONTH ( EDATE ( [Date], -3 ) ), 3 ) / 3,
"FY",
VAR CY =
RIGHT ( YEAR ( [Date] ), 2 )
VAR NY =
RIGHT ( YEAR ( [Date] ) + 1, 2 )
VAR PY =
RIGHT ( YEAR ( [Date] ) - 1, 2 )
VAR FinYear =
IF ( MONTH ( [Date] ) > 3, CY & "-" & NY, PY & "-" & CY )
RETURN
FinYear,
"FinWeekNo", WEEKNUM ( EDATE ( [Date], -3 ), 2 ),
"CalWeekNo", WEEKNUM ( [Date], 2 ),
"Weekend/Working", IF ( WEEKDAY ( [Date], 2 ) > 5, "Weekend", "Working" ),
"Day", FORMAT ( [Date], "ddd" ),
"CustomDate", FORMAT ( [Date], "d/mm" )
)

1 Reply

  • az38's avatar
    az38
    Community Champion

    Hi KRISH80 

    you need to upload into model another business-calendar with holidays.

    it could be calendar from your data storage or third-party, but there is no such built-in option in power bi 

     

    do not hesitate to give a kudo to useful posts and mark solutions as solution

    LinkedIn