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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MNM
Frequent Visitor

Customize Fiscal Week

Hi!

 

I am stuck with this scenario. Is it possible to create a week number column wherein the first week consist of 8 days and the 4th or 5th week is 6 days depending on the month? Please see below sample.

 

Jan 28 to Feb 4 = 1st week

Feb 5 to Feb 11 = 2nd week

Feb 12 to Feb 18 = 3rd week

Feb 19 to feb 24 = 4th week

Feb 25 to Mar 4 = 1st week

Mar 5 to Mar 11 = 2nd week

Mar 12 to 18 = 3rd week

Mar 19 to Mar 25 = 4th week

Mar 26 to 31 = 5th week

an so on...

 

Thank you in advance.

 

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @MNM,

 

You can use the DAX function WEEKNUM to achieve this.

 

Custom Week Number =
VAR DaysInWeek =
    IF(
        MONTH([Date]) <> MONTH([Date] - 7),
        8,
        IF(
            MONTH([Date]) = 2,
            IF(
                DAY([Date] - WEEKDAY([Date], 1)) < 28,
                8,
                IF(
                    DAY([Date] - WEEKDAY([Date], 1)) > 28,
                    6,
                    7
                )
            ),
            7
        )
    )
RETURN
    WEEKNUM([Date], 2) +
        IF(
            WEEKDAY([Date], 2) = 1,
            0,
            IF(
                WEEKDAY([Date], 2) < 5,
                1,
                IF(
                    WEEKDAY([Date], 2) + DaysInWeek > 7,
                    2,
                    1
                )
            )
        )

 

Hope this helps. Should you require further assistance, please do not hesitate to reach out.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hello @Sahir_Maharaj 

I tried applying the dax but its not showing the correct week number.

 

Custom Week Number =
VAR DaysInWeek =
    IF(
        MONTH('Dates'[Date]) <> MONTH('Dates'[Date] - 7),
        8,
        IF(
            MONTH('Dates'[Date]) = 2,
            IF(
                DAY('Dates'[Date] - WEEKDAY('Dates'[Date],1)) < 28,
                8,
                IF(
                    DAY('Dates'[Date] - WEEKDAY('Dates'[Date],1)) > 28,
                    6,
                    7
                )
            ),
            7
        )
    )
RETURN
    WEEKNUM('Dates'[Date],2) +
        IF(
            WEEKDAY('Dates'[Date], 2) = 1,
            0,
            IF(
                WEEKDAY('Dates'[Date], 2) < 5,
                1,
                IF(
                    WEEKDAY('Dates'[Date],2) + DaysInWeek > 7,
                    2,
                    1
                )
            )
        )
            MNM_0-1678242381438.png

Thank you in advance

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.