Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I created a calendar table
Solved! Go to Solution.
Hi @Nun
Add a YearMonth column when you create WEEKDAY table.
WEEKDAY = ADDCOLUMNS(CALENDAR(DATE(2021,01,02),DATE(2021,12,31)),"YearMonth",YEAR([Date])*100+MONTH([Date]))
Then build try my code.
Flag =
VAR _WeekDay = WEEKDAY('WEEKDAY'[Date],2)
VAR _Rank = IF(_WeekDay in {6,7},BLANK(),1)
RETURN
_RankWD =
VAR _WeekDay = WEEKDAY('WEEKDAY'[Date],2)
VAR _Result = IF(_WeekDay in {6,7},BLANK(),"WD"&""&CALCULATE(SUM('WEEKDAY'[Flag]),FILTER('WEEKDAY','WEEKDAY'[YearMonth] = EARLIER('WEEKDAY'[YearMonth])&&'WEEKDAY'[Date]<=EARLIER('WEEKDAY'[Date]))))
RETURN
_Result
Result:
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Nun , I think you need work day number of month, see if these columns can help
Work Day = if(WEEKDAY([Date],2)>=6,0,1)
Work Date = if(WEEKDAY([Date],2)>=6,BLANK(),[Date])
Work day of month = Sumx(filter(Date, [Month year] = earlier([Month year])),[Work Day])
Work day of week = Sumx(filter(Date, [Weekyear] = earlier([Weekyear])),[Work Day])
@amitchandak , thanks for supporting.
I checked a previous post from you 🙂 which is high appreciated, I created the columns described
but how I can assign "WD1" to the first working day (in January is 04.01.2021 ((Monday)), in April is 01.04.201 (Thu), as well WD2..?
Thank you in advance!
Hi @Nun
Add a YearMonth column when you create WEEKDAY table.
WEEKDAY = ADDCOLUMNS(CALENDAR(DATE(2021,01,02),DATE(2021,12,31)),"YearMonth",YEAR([Date])*100+MONTH([Date]))
Then build try my code.
Flag =
VAR _WeekDay = WEEKDAY('WEEKDAY'[Date],2)
VAR _Rank = IF(_WeekDay in {6,7},BLANK(),1)
RETURN
_RankWD =
VAR _WeekDay = WEEKDAY('WEEKDAY'[Date],2)
VAR _Result = IF(_WeekDay in {6,7},BLANK(),"WD"&""&CALCULATE(SUM('WEEKDAY'[Flag]),FILTER('WEEKDAY','WEEKDAY'[YearMonth] = EARLIER('WEEKDAY'[YearMonth])&&'WEEKDAY'[Date]<=EARLIER('WEEKDAY'[Date]))))
RETURN
_Result
Result:
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot!!!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!