Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
zenga
Regular Visitor

Month from Year + week number

People, 

My fact table have no Date column , i just have the Year and Week number columns,
there any way to use DAX to dicovery the month of this combination (Year + week number) ?

I know, some times we have a week num existing in 2 months... but if is possible to choose the month when de weekstarts, could be good...

Thanks

2 ACCEPTED SOLUTIONS
vicky_
Super User
Super User

The easiest way would be to just create a new date table using CALENDARAUTO() and add a column for weeks, then join the two / create a relationship between them. If you're worried about one week having two months, take a look at the ISO Weeks functions here, which should help you pick the starting day for each week.  

View solution in original post

FreemanZ
Super User
Super User

hi @zenga 

you would

1) need a DataTable to help you, e.g. like this:

DateYearWeekNumberMonth

1/31/2022202261
2/1/2022202262
4/30/20222022184
5/1/20222022195

2) add a column in your FactTable like this:

Month = 
VAR _year = [Year]
VAR _wn = [WeekNumber]
RETURN
MINX(
    FILTER(
        DateTable,
        DateTable[Year] = _year
            &&DateTable[WeekNumber] =_wn
    ),
    DateTable[Month]
)

 

i tried an it worked like this:

FreemanZ_0-1672973348661.png

 

BTW, if you can, for date calculation, try always to have a date column in fact table connected to a decent date table. 

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @zenga 

you would

1) need a DataTable to help you, e.g. like this:

DateYearWeekNumberMonth

1/31/2022202261
2/1/2022202262
4/30/20222022184
5/1/20222022195

2) add a column in your FactTable like this:

Month = 
VAR _year = [Year]
VAR _wn = [WeekNumber]
RETURN
MINX(
    FILTER(
        DateTable,
        DateTable[Year] = _year
            &&DateTable[WeekNumber] =_wn
    ),
    DateTable[Month]
)

 

i tried an it worked like this:

FreemanZ_0-1672973348661.png

 

BTW, if you can, for date calculation, try always to have a date column in fact table connected to a decent date table. 

vicky_
Super User
Super User

The easiest way would be to just create a new date table using CALENDARAUTO() and add a column for weeks, then join the two / create a relationship between them. If you're worried about one week having two months, take a look at the ISO Weeks functions here, which should help you pick the starting day for each week.  

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.