cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
srinival
Helper I
Helper I

Custom Calendar (My Month should be from 2nd Week to 2nd Week)

Hi All,

 

I want to develop a Custom Calendar where the first day of the Month should be 2nd Monday and Last day should 2nd Sunday of the Month.

 

I am not clear on how to arrive at this solution, any idea's in this direction will help me.

 

Regards

Srini

3 REPLIES 3
srinival
Helper I
Helper I

Hi Amit,

 

My Requirement is something Like this, we need to define enter year calendar for next 3 years. And our 1st Day of the Month will 2nd Monday and should end by 2nd Sunday of Next Month.

 

And we want to have this calendar for 2021,2022,2033 and 2024.

 

Maybe My requierment was not clearly projected earlier.

 

Your inputs is highly appreciated.

 

Regards

Sri

@srinival , Try like

Date = 
var _year = 2018
return 
Addcolumns(calendar(date(_year,01,01), date(_year,12,31) )
, "Start Of Month",var _st = eomonth([Date], -1) +1
    Var _Second  = _st +-1*WEEKDAY(_st ,2)+8 
    return
    _Second 
, "End Of Month",var _st = eomonth([Date], 0) +1
    Var _Second  = _st +-1*WEEKDAY(_st ,2)+7 
    return
    _Second 
, "Week Start date" , [Date]+-1*WEEKDAY([Date],2)+1 
, "Year", year([date])
, "Month Year", format([date],"mmm-yyyy") 
, "Month year sort", year([date])*100 + month([date])
, "Month",FORMAT([Date],"mmmm")
, "Month sort", month([DAte])
, "Weekday", FORMAT([Date], "ddd")
)


!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
amitchandak
Super User
Super User

@srinival ,

 

Start of Month =

var _st = eomonth([Date], -1) +1

Var _Second  = _st +-1*WEEKDAY(_st ,2)+1  + 14

return

_Second 

 

 

End of Month =

var _st = eomonth([Date], 0) +1

Var _Second  = _st +-1*WEEKDAY(_st ,2)+1  + 13

return

_Second 



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors