Forum Discussion
Calendar/Date help
Hi rp2022 - create below calculated column for new week:
New Week =
VAR CurrentDate = 'Table'[Date]
VAR DayOfWeek = WEEKDAY(CurrentDate, 1) -- 1 = Sunday, 7 = Saturday
VAR Is27th = DAY(CurrentDate) = 27 && DayOfWeek = 6 -- 27th is a Friday
VAR Is26th = DAY(CurrentDate) = 26 && DayOfWeek = 7 -- 26th is a Saturday
VAR StartOfWeek =
IF(
Is27th,
DATE(YEAR(CurrentDate), MONTH(CurrentDate) + 1, 1),
CurrentDate - MOD(DayOfWeek + 1, 7) -- Back to Saturday
)
VAR WeekNumber =
RANKX(
FILTER('Table', YEAR([Date]) = YEAR(CurrentDate) && MONTH([Date]) = MONTH(CurrentDate)),
StartOfWeek,
, ASC
)
RETURN
IF(Is27th || Is26th, WeekNumber, WeekNumber)
another columne for reporting date
Reporting Date =
VAR CurrentDate = 'Table'[Date]
VAR DayOfWeek = WEEKDAY(CurrentDate, 1) -- 1 = Sunday, 7 = Saturday
VAR StartOfWeek =
CurrentDate - MOD(DayOfWeek + 1, 7) -- Back to Saturday
RETURN
StartOfWeek
Hope this works. please check
- rp20221 year agoHelper II
Thanks for the reply. But, this doesnt work