Forum Discussion
Calculating Week number from today to back dated for last 5 Week
- 2 years ago
Dates = ADDCOLUMNS ( CALENDAR ( "2024-01-01", TODAY () ), "WeekBack", VAR wd = WEEKDAY ( TODAY (), 2 ) VAR wb = INT ( DIVIDE ( 14 + TODAY () - wd - [Date], 7 ) ) RETURN IF ( wb < 6, FORMAT ( wb, "\W#" ) ) ) - Anonymous2 years ago
Hi SurendraD
Your solution is great, lbendlin. It worked like a charm! Here I have another idea in mind, and I would like to share it for reference.
You can try this calculated column as follows.
Week Number = VAR CurrentWeek = WEEKNUM(MAX([Date]), 2) VAR DateWeek = WEEKNUM([Date], 2) RETURN IF((CurrentWeek - DateWeek + 1) <= 5, "W" & CurrentWeek - DateWeek + 1, BLANK())Result:
When I changed the date to today (3/25/2024):
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi SurendraD
Your solution is great, lbendlin. It worked like a charm! Here I have another idea in mind, and I would like to share it for reference.
You can try this calculated column as follows.
Week Number =
VAR CurrentWeek = WEEKNUM(MAX([Date]), 2)
VAR DateWeek = WEEKNUM([Date], 2)
RETURN IF((CurrentWeek - DateWeek + 1) <= 5, "W" & CurrentWeek - DateWeek + 1, BLANK())
Result:
When I changed the date to today (3/25/2024):
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.