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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Powereports
Helper I
Helper I

Creating Customized Fiscal Week Column

Hello Users,

I am trying to create a customized Fiscal week column based on the Fiscal period starting from September - August and week starting on Monday. 

My Problem is i am getting partial weeks and really want to get rid of it. As an example by using the below Dax I am getting, 01-Sept-2019 ( Sunday ) as week 1 and 02-Sept-2019 (Monday) as Week 2 , similarly 31-Aug-2020 as Week 54.

Need suggestions as to compute Dax such that we get only full weeks and only 52 weeks in total for year. Then 01-sept-2019 will have no week number and so would be the case with 31-Aug-2020.

Dax Formula used:

 

 

 

Fiscal Week =
 
VAR WeekStartsOn = "Mon"
VAR FiscalStartMonth = 9
VAR FiscalmaxWeek = 52
--Calculation--
VAR FiscalFirstDay =
IF(
MONTH('Calendar'[Date]) < FiscalStartMonth,
DATE(
YEAR('Calendar'[Date])-1,
FiscalStartMonth,1
),
DATE(
YEAR('Calendar'[Date]),
FiscalStartMonth,1
 
)
)
VAR FilteredTableCount =
COUNTROWS(
FILTER(
SELECTCOLUMNS(
GENERATESERIES(
FiscalFirstDay,
'Calendar'[Date]
),
"Dates",
[Value]
),
FORMAT([Dates],"ddd") = WeekStartsOn
)
)
VAR WeekNos =
IF(
FORMAT(FiscalFirstDay,"ddd") <> WeekStartsOn,
FilteredTableCount +1 ,
FilteredTableCount
)
RETURN
"Week " & WeekNos
 
 
image.png

Thanks in advance for your help!!

2 ACCEPTED SOLUTIONS

Hi @Powereports ,

 

Try this:

 

Modified Fiscal Week =
VAR DaysofBlank =
    COUNTROWS (
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
                && 'Calendar'[Fiscal WeekNum] = BLANK ()
        )
    )
VAR MaxWeek =
    CALCULATE (
        MAX ( 'Calendar'[Fiscal WeekNum] ),
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
        )
    )
VAR DayofMaxWeek =
    COUNTROWS (
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
                && 'Calendar'[Fiscal WeekNum] = MaxWeek
        )
    )
VAR Week =
    IF (
        [Fiscal WeekNum] = BLANK ()
            || [Fiscal WeekNum] = MaxWeek
            && DayofMaxWeek <> 7,
        BLANK (),
        [Fiscal WeekNum]
    )
VAR ModifiedWeek =
    SWITCH (
        TRUE (),
        MaxWeek >= 53, Week,
        MaxWeek = 52
            && DayofMaxWeek >= 4, [Fiscal WeekNum],
        MaxWeek <= 52
            && DayofMaxWeek < 4
            && DaysofBlank >= 4,
            IF ( [Fiscal WeekNum] <> MaxWeek, Week + 1 )
    )
RETURN
    IF ( ModifiedWeek <> BLANK (), "Week " & ModifiedWeek )

 

WEEK.JPG

WEEK2.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

View solution in original post

Icey
Community Support
Community Support

Hi @Powereports ,

 

Can this meet your requirements?

 

 

Best Regards,

Icey

View solution in original post

5 REPLIES 5
Powereports
Helper I
Helper I

@Icey ,

Thanks a ton!! Your helped me to achieve the desired output.

 

 

 

Icey
Community Support
Community Support

Hi @Powereports ,

 

Can this meet your requirements?

 

 

Best Regards,

Icey

Icey
Community Support
Community Support

Hi @Powereports ,

 

Try this:

 

1. Create a 'Fiscal Year' column.

Fiscal Year =
VAR FiscalStartMonth = 9
RETURN
    IF (
        MONTH ( 'Calendar'[Date] ) < FiscalStartMonth,
        "FY"
            & YEAR ( 'Calendar'[Date] ) - 1,
        "FY" & YEAR ( 'Calendar'[Date] )
    )

 

2. Create a 'Fiscal WeekNum' column.

Fiscal WeekNum = 
VAR WeekDay =
    WEEKDAY ( [Date], 2 )
VAR FiscalStartMonth = 9
VAR FiscalmaxWeek = 52 --Calculation--
VAR FiscalFirstDay =
    IF (
        MONTH ( 'Calendar'[Date] ) < FiscalStartMonth,
        DATE ( YEAR ( 'Calendar'[Date] ) - 1, FiscalStartMonth, 1 ),
        DATE ( YEAR ( 'Calendar'[Date] ), FiscalStartMonth, 1 )
    )
VAR FilteredTableCount =
    COUNTROWS (
        FILTER (
            SELECTCOLUMNS (
                GENERATESERIES ( FiscalFirstDay, 'Calendar'[Date] ),
                "Dates", [Value]
            ),
            WEEKDAY ( [Dates], 2 ) = 1
        )
    )
RETURN
    FilteredTableCount

 

3. Create a 'Modified Fiscal Week' column.

Modified Fiscal Week = 
VAR MaxWeek =
    CALCULATE (
        MAX ( 'Calendar'[Fiscal WeekNum] ),
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
        )
    )
VAR DayofMaxWeek =
    COUNTROWS (
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
                && 'Calendar'[Fiscal WeekNum] = MaxWeek
        )
    )
RETURN
    IF (
        [Fiscal WeekNum] = BLANK ()
            || [Fiscal WeekNum] = MaxWeek
            && DayofMaxWeek <> 7,
        BLANK (),
        "Week " & [Fiscal WeekNum]
    )

Fiscal Week 2.JPGFiscal Week 1.JPG

 

BTW, .pbix file attached.

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

Hi Icey,

Thanks for solution. Your solution did solve my problem to some extent, but i am trying to figure out if there is a way to get 52 weeks as below.

I understand that based on the the Modified Weeknumber logic, Dax gave blank values for Sep1,2020- sep6,2020 but at the same time it returned only 51 weeks for the Fiscal year 2020. So I was wondering if we could use a condition such that if the  weeknum <52 and First blank week or last blank week (In this case sep1,2020 -sep6,2020) whichever week has more than 4 days in that week , assign it a weeknumber (In this case Sep01-06 can be week 1?

Fiscal week.PNG

 

Fiscal week Num.JPG

 Thanks again!! Really appreciate your help.

 

Hi @Powereports ,

 

Try this:

 

Modified Fiscal Week =
VAR DaysofBlank =
    COUNTROWS (
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
                && 'Calendar'[Fiscal WeekNum] = BLANK ()
        )
    )
VAR MaxWeek =
    CALCULATE (
        MAX ( 'Calendar'[Fiscal WeekNum] ),
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
        )
    )
VAR DayofMaxWeek =
    COUNTROWS (
        FILTER (
            'Calendar',
            'Calendar'[Fiscal Year] = EARLIER ( 'Calendar'[Fiscal Year] )
                && 'Calendar'[Fiscal WeekNum] = MaxWeek
        )
    )
VAR Week =
    IF (
        [Fiscal WeekNum] = BLANK ()
            || [Fiscal WeekNum] = MaxWeek
            && DayofMaxWeek <> 7,
        BLANK (),
        [Fiscal WeekNum]
    )
VAR ModifiedWeek =
    SWITCH (
        TRUE (),
        MaxWeek >= 53, Week,
        MaxWeek = 52
            && DayofMaxWeek >= 4, [Fiscal WeekNum],
        MaxWeek <= 52
            && DayofMaxWeek < 4
            && DaysofBlank >= 4,
            IF ( [Fiscal WeekNum] <> MaxWeek, Week + 1 )
    )
RETURN
    IF ( ModifiedWeek <> BLANK (), "Week " & ModifiedWeek )

 

WEEK.JPG

WEEK2.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.