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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.