Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I have the following DAX code to generate a calendar.
Solved! Go to Solution.
hi @lucie_rabochova ,
try like:
DimDates =
VAR BaseCalendar =
CALENDAR(DATE(2022,1,1), TODAY())
RETURN
FILTER(
GENERATE(
BaseCalendar,
VAR BaseDate = [Date]
VAR YearDate = YEAR(BaseDate)
VAR Week = WEEKNUM(BaseDate,2)-1
RETURN
ROW (
"Year",YearDate,
"YearMonth",FORMAT(BaseDate,"yyyy-mm"),
"Quarter", FORMAT(BaseDate, "\Quarter q"),
"Weeknumber",WEEKNUM (BaseDate,2),
"YearWeeknumber", FORMAT(BaseDate,"yyyy") &"-"& FORMAT(WEEKNUM (BaseDate,2),"00")
)
),
[Weeknumber]<>53
)
Thank you, works perfect!
hi @lucie_rabochova ,
try like:
DimDates =
VAR BaseCalendar =
CALENDAR(DATE(2022,1,1), TODAY())
RETURN
FILTER(
GENERATE(
BaseCalendar,
VAR BaseDate = [Date]
VAR YearDate = YEAR(BaseDate)
VAR Week = WEEKNUM(BaseDate,2)-1
RETURN
ROW (
"Year",YearDate,
"YearMonth",FORMAT(BaseDate,"yyyy-mm"),
"Quarter", FORMAT(BaseDate, "\Quarter q"),
"Weeknumber",WEEKNUM (BaseDate,2),
"YearWeeknumber", FORMAT(BaseDate,"yyyy") &"-"& FORMAT(WEEKNUM (BaseDate,2),"00")
)
),
[Weeknumber]<>53
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |