Forum Discussion
ScottBrown
1 year agoHelper II
Week Index Column for Power Query
I am trying to create a week index for Power Query. It would show something like this for the date range ...-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5... for all weeks in the date table. My formula fo...
- 1 year ago
7 or -7 is the difference in days, not weeks, so just divide by 7.
#"Fiscal Week Index" = Table.TransformColumnTypes( Table.AddColumn( StartOfWeek, "Fiscal Week Index", each ([StartOfWeek] - [StartOfCurrentWeek]) / 7 ), {{"Fiscal Week Index", Int64.Type}} )
ZhangKun
1 year agoSuper User
7 or -7 is the difference in days, not weeks, so just divide by 7.
#"Fiscal Week Index" = Table.TransformColumnTypes(
Table.AddColumn(
StartOfWeek,
"Fiscal Week Index",
each ([StartOfWeek] - [StartOfCurrentWeek]) / 7
),
{{"Fiscal Week Index", Int64.Type}}
)