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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
verowin
Frequent Visitor

Build a calendar table where week 1 starts on 12/24/22

Build a calendar table where

week 1 starts on 12/24/22

week 2 starts on 12/31/22

all the way to week 52 starts on 12/16/23

and week 1 starts on 12/23/23

and so on

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@verowin 

maybe you can try this

Column = 
VAR _DATEDIF=DATE(YEAR('calendar'[Date]),12,31)-'calendar'[Date]
var _DATEDIF2= IF(_DATEDIF<=7,('calendar'[Date]-DATE(YEAR('calendar'[Date]),12,24)+1),('calendar'[Date]-DATE(YEAR('calendar'[Date])-1,12,24)+1))
RETURN ROUNDUP(_DATEDIF2/7,0)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@verowin 

maybe you can try this

Column = 
VAR _DATEDIF=DATE(YEAR('calendar'[Date]),12,31)-'calendar'[Date]
var _DATEDIF2= IF(_DATEDIF<=7,('calendar'[Date]-DATE(YEAR('calendar'[Date]),12,24)+1),('calendar'[Date]-DATE(YEAR('calendar'[Date])-1,12,24)+1))
RETURN ROUNDUP(_DATEDIF2/7,0)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.