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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Shawry
Helper I
Helper I

Last 6 Weeks formula has stopped working due to new year.

Hi everyone, 
 
My formula to calculate whether has stopped working now that we're in 2024. And I'm having trouble seeing what the problem is. It's the 'IsLast6Weeks?' column, and was working perfectly up until 31/12/2023. I've included a screenshot and have pasted the formula below. Thanks!
 
IsLast6Weeks? = IF('Date'[TodayWeekNum]-'Date'[Week Number]<7 && 'Date'[TodayWeekNum]-'Date'[Week Number]>0 && year(TODAY()) = 'Date'[Year],"Last 6 weeks", "False")
 
Shawry_0-1704146516966.png
1 REPLY 1
jdbuchanan71
Super User
Super User

Rather than using the week number you can just calculate the date of the start of the week 6 weeks ago and compare it to that.

Something like this.

IsLast6Weeks? = 
VAR _Today = TODAY()
VAR _6WeekStart = _Today - (35 + WEEKDAY( _Today ) ) +1
RETURN IF (
    [Date] >= _6WeekStart && [Date] <= _Today, 
    "Last 6 weeks", "False"
)

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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