Forum Discussion
Chanleakna123
5 years agoPost Prodigy
Custom Column on Week
hi all , can anyone help me with the code ? in Year 2021 is the different between the Past Year. as i calculate Week Number I used the Code : if Date.WeekOfYear([Date],6)>52 then 52 else Date.W...
- 5 years ago
Update it as follows:
#"Added Custom1" = Table.AddColumn(#"Sorted Rows", "Week Number", each if Date.WeekOfYear([Date],6)>52 then 52 else if ([Year]=2021 and List.Contains({1,2}, Date.WeekOfYear([Date],6))) then 1 esle if [Year]=2021 then (Date.WeekOfYear([Date],6)-1) else Date.WeekOfYear([Date],6))Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Anonymous
5 years agoNot applicable
Hi Chanleakna123 ,
You could try two calculated column.
Week Num =
WEEKNUM ( [Date] + 1, 1 )New Week Num =
IF (
[Date] <= DATE ( 2021, 1, 8 )
&& [Date] >= DATE ( 2021, 1, 1 ),
1,
IF (
[Date] > DATE ( 2021, 1, 8 )
&& [Date] <= DATE ( 2021, 12, 31 ),
[Week Num] - 1,
[Week Num]
)
)You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.