Forum Discussion
Anonymous
5 years agoNot applicable
WEEKNUM returns false calendar weeks
Hello, I am facing the following issue: I am trying to calculate the calendar weeks with WEEKNUM() and have the following errors with the two different variants of the function: -Calendarweek...
- 5 years ago
Anonymous - I found a formula for ISO Year from a previous post. This should get you what you want.
CalendarWeek = VAR __Wk = WEEKNUM ( DateTab[Date], 21 ) VAR __ISOYr = IF ( AND ( WEEKNUM ( DateTab[Date], 21 ) < 5, WEEKNUM ( DateTab[Date], 2 ) > 50 ), DateTab[Year] + 1, IF ( AND ( WEEKNUM ( DateTab[Date], 21 ) > 50, WEEKNUM ( DateTab[Date], 2 ) < 5 ), DateTab[Year] - 1, DateTab[Year] ) ) RETURN __ISOYr & "-" & __WkHope this helps
David
Anonymous
5 years agoNot applicable
Hi! I'd like to have the 1st, 2nd and 3rd of January 31 still part of 2020 - 53.
How can I build this in?
dedelman_clng
Community Champion
5 years agoAnonymous - I found a formula for ISO Year from a previous post. This should get you what you want.
CalendarWeek =
VAR __Wk =
WEEKNUM ( DateTab[Date], 21 )
VAR __ISOYr =
IF (
AND ( WEEKNUM ( DateTab[Date], 21 ) < 5, WEEKNUM ( DateTab[Date], 2 ) > 50 ),
DateTab[Year] + 1,
IF (
AND ( WEEKNUM ( DateTab[Date], 21 ) > 50, WEEKNUM ( DateTab[Date], 2 ) < 5 ),
DateTab[Year] - 1,
DateTab[Year]
)
)
RETURN
__ISOYr & "-" & __Wk
Hope this helps
David
- Anonymous5 years agoNot applicable
Fantastic! It worked!! Thank you. 🙂