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.
Hi Community!
I need some help to create a calendar 4-4-5, but iniciated from the mondays. For this year(2022) the first monday was 03-jun, then count 4, the next was 31-janthen count 4, next was 28-feb count 5.... and write in a column the number of the weeks for that every date
dates | week num (4-4-5) | |
01/01/2022 | 5 | |
02/01/2022 | 5 | |
03/01/2022 | 4 | |
04/01/2022 | 4 | |
... | 4 | |
31/01/2022 | 4 | |
.. | 4 | |
28/02/2022 | 5 | |
... | 5 | |
04/04/2022 | 4 | |
.... | ... | |
31/12/2022 | 5 |
Thanks
Solved! Go to Solution.
@alfredorhz , whatever date you want has the start of year, take that and do -364 days nas use that as first date in calendar
date(2022,0,03) -364, and then you can use filter on the calendar to restrict year
refer this
https://medium.com/@amitchandak/cheat-sheet-power-bi-4-4-4-and-4-4-5-calendar-786f76da7d92
@alfredorhz , whatever date you want has the start of year, take that and do -364 days nas use that as first date in calendar
date(2022,0,03) -364, and then you can use filter on the calendar to restrict year
refer this
https://medium.com/@amitchandak/cheat-sheet-power-bi-4-4-4-and-4-4-5-calendar-786f76da7d92
Hi @amitchandak
thanks for respond
I´m not sure were I need to pur this "date(2022,0,03) -364," do you mind the first date of calendar? like this?
Cal 445 = var _cal = CALENDAR(Date(2018,01,01) date(2022,0,03) -364, Date(2022,12,31))
return ADDCOLUMNS( _cal
,"Year" , QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,364)+1
,"Day Of Year" , Mod( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,364)+1
,"Qtr" , Mod(QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,91),4) +1
,"Week of Month" , var _1 = mod(Mod(QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,7),52),13)
var _2 = if(_1=12, 5, mod(_1,4) +1)
return _2
,"Month no" , var _1 = mod(Mod(QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,7),52),13)
var _2 = if(_1=12, 3, QUOTIENT( _1,4) +1)
return Mod(QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,91),4)*3 + _2
,"Year Month" , (QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,364)+1)*100 + Mod(QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,28),13)+1
,"Week" , Mod(QUOTIENT( DATEDIFF(Minx(_cal, [Date]), [Date], day) ,7),52)+1
)
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |