Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
_Rank
WD =
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
_Rank
WD =
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!!!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
107 | |
105 | |
87 | |
61 |