cancel
Showing results for 
Search instead for 
Did you mean: 

First Working Day of Week

Super User
849 Views
Highlighted
Super User
Super User

First Working Day of Week

Suppose you need to know the first working day of the month and whether today is the first working day of the month. Use these measures:

 

First Working Day

 

First Working Day of Week = 
VAR TodaysDate = TODAY()
VAR Calendar1 = CALENDAR(DATE(YEAR(TodaysDate),1,1),DATE(YEAR(TodaysDate),12,31))
VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekNum1",WEEKNUM([Date]))
VAR Calendar3 = ADDCOLUMNS(Calendar2,"WeekDay1",WEEKDAY([Date],2))
VAR TodaysWeekNum = WEEKNUM(TodaysDate)
VAR Calendar4 = FILTER(Calendar3,[WeekNum1]=TodaysWeekNum&&[WeekDay1]<6)
VAR FirstWorkingDay = MINX(Calendar4,[Date])
RETURN FORMAT(FirstWorkingDay,"mm/dd/yyyy")

Is First Working Day

 

 

Is First Working Day = 
VAR TodaysDate = TODAY()
VAR Calendar1 = CALENDAR(DATE(YEAR(TodaysDate),1,1),DATE(YEAR(TodaysDate),12,31))
VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekNum1",WEEKNUM([Date]))
VAR Calendar3 = ADDCOLUMNS(Calendar2,"WeekDay1",WEEKDAY([Date],2))
VAR TodaysWeekNum = WEEKNUM(TodaysDate)
VAR Calendar4 = FILTER(Calendar3,[WeekNum1]=TodaysWeekNum&&[WeekDay1]<6)
VAR FirstWorkingDay = MINX(Calendar4,[Date])
RETURN IF(TodaysDate=FirstWorkingDay,TRUE(),FALSE())

 

 

 


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!