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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mike9999
Helper I
Helper I

DAX Week Table and Not by Day

Hi,

I'm trying to make a DAX table that shows all of the weeks within a particular range (ex. Dec 1, 2022 to Dec 31, 2023).

 

CALENDAR will have every single day of the range however, I simply want the first day of the week, so I am attempting to filter down using [DayOfWeek] = 1 however I get an error "Cannot find table FullCalendar"

Desired output:

YearWeek NumberYear-WeekDayOfWeekFirstDayOfWeek
2022502022-50112/5/22
2022512022-51112/12/22
2022522022-52112/19/22
2022532022-53112/26/22
202312023-111/2/23
202322023-211/9/23
202332023-311/16/23
202342023-411/23/23

 

Current DAX Table with error:

 

WeekTable = 
VAR FullCalendar =
    ADDCOLUMNS(
        CALENDAR("2022/12/1", "2023/12/31"),
        "Week Number", WEEKNUM([Date]),
        "Year", YEAR([Date]),
        "Year-Week", YEAR([Date]) & "-" & WEEKNUM([Date]),
        "FirstDayOfWeek", [Date],
        "DayOfWeek", WEEKDAY([Date],2)
    )
RETURN
    CALCULATETABLE(
            SUMMARIZE(
            FullCalendar,
            [Week Number],
            [Year],
            [Year-Week],
            [FirstDayOfWeek],
            [DayOfWeek]
        ),
        FullCalendar[DayOfWeek] = 1
    )

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correclty, but if you want to see the result of the above formula, please try something like below.

WeekTable =
FILTER (
    SUMMARIZE (
        ADDCOLUMNS (
            CALENDAR ( "2022/12/1", "2023/12/31" ),
            "Week Number", WEEKNUM ( [Date] ),
            "Year", YEAR ( [Date] ),
            "Year-Week",
                YEAR ( [Date] ) & "-"
                    & WEEKNUM ( [Date] ),
            "FirstDayOfWeek", [Date],
            "DayOfWeek", WEEKDAY ( [Date], 2 )
        ),
        [Week Number],
        [Year],
        [Year-Week],
        [FirstDayOfWeek],
        [DayOfWeek]
    ),
    [DayOfWeek] = 1
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correclty, but if you want to see the result of the above formula, please try something like below.

WeekTable =
FILTER (
    SUMMARIZE (
        ADDCOLUMNS (
            CALENDAR ( "2022/12/1", "2023/12/31" ),
            "Week Number", WEEKNUM ( [Date] ),
            "Year", YEAR ( [Date] ),
            "Year-Week",
                YEAR ( [Date] ) & "-"
                    & WEEKNUM ( [Date] ),
            "FirstDayOfWeek", [Date],
            "DayOfWeek", WEEKDAY ( [Date], 2 )
        ),
        [Week Number],
        [Year],
        [Year-Week],
        [FirstDayOfWeek],
        [DayOfWeek]
    ),
    [DayOfWeek] = 1
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Amazing, thank you. If I compare the difference from what I did, I'm assuming the issue was that the CALCULATETABLE filter doesn't work for this purpose since the VAR variable is not yet a table. Keeping the solution as a simple FILTER/SUMMARIZE without the VAR as you have shown is more concise and gets the correct solution.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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