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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
1001
Resolver II
Resolver II

Looking to write DAX to count back 26 weeks or a 52 week July to June year.

Hi, I would like to input a weeknumber function for a July Wk1 to June W52 financial year for Australia.  Just wondering if anyone had a suitable DAX for this? thanks.   

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @1001 ,

 

Try this.

Week number = 
VAR _week =
    RANKX (
        FILTER (
            'Calendar',
            WEEKNUM ( 'Calendar'[Date], 2 ) >= 27
                && WEEKNUM ( 'Calendar'[Date], 2 ) <= 53
        ),
        WEEKNUM ( 'Calendar'[Date], 2 ),
        ,
        ASC,
        DENSE
    )
RETURN
    IF (
        WEEKNUM ( 'Calendar'[Date], 2 ) >= 27
            && WEEKNUM ( 'Calendar'[Date], 21 ) <= 53,
        _week,
        WEEKNUM ( 'Calendar'[Date], 2 ) + 26
    )

If this doesn't work for you, you can post a screenshot of your expected output.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

1001
Resolver II
Resolver II

Thanks Gao, Sincerely appreriat that. 

View solution in original post

2 REPLIES 2
1001
Resolver II
Resolver II

Thanks Gao, Sincerely appreriat that. 

Anonymous
Not applicable

Hi @1001 ,

 

Try this.

Week number = 
VAR _week =
    RANKX (
        FILTER (
            'Calendar',
            WEEKNUM ( 'Calendar'[Date], 2 ) >= 27
                && WEEKNUM ( 'Calendar'[Date], 2 ) <= 53
        ),
        WEEKNUM ( 'Calendar'[Date], 2 ),
        ,
        ASC,
        DENSE
    )
RETURN
    IF (
        WEEKNUM ( 'Calendar'[Date], 2 ) >= 27
            && WEEKNUM ( 'Calendar'[Date], 21 ) <= 53,
        _week,
        WEEKNUM ( 'Calendar'[Date], 2 ) + 26
    )

If this doesn't work for you, you can post a screenshot of your expected output.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.