Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Offset dates for week number

Credit to Enterprise DNA for setting me on this path (Get Power BI Previous Week Values Using DAX & Power Query (enterprisedna.co))

 

I can't seem to find the formula to properly offset the week numbers. I've tried looking up the Microsoft Offset function explanation but I am incredibly lost. 

 

What I'm trying to achieve is the current week shows as 0, the previous week shows at -1 and next week would be one. 

 

I have tried the following but I know it will trip me up when the year changes:

LW = IF(dim_date[Year]=YEAR(today()),if(dim_date[Week Number]=WEEKNUM(today())-1,TRUE(),FALSE())
 
Thanks in advance.