Forum Discussion
Connect week_year with calendar table
Hi,
I have a problem where I have data with year and weeknumber that I need to connect to a calendar table. This must be done with a date key in the fact table, but I am not sure how to produce a correct start/end date with just year and weeknumber. Does anyone know how to fix this? Amit
Thanks in advance
Assuming your Year and Week columns are Integer type, you can use this expression in a custom column. You could then make a relationship from a date table to this new column.
= Date.EndOfWeek(Date.AddDays(#date([Year],1,1), ([Week]-1)*7))
Pat
5 Replies
- mahoneypat
Microsoft Employee
Assuming your Year and Week columns are Integer type, you can use this expression in a custom column. You could then make a relationship from a date table to this new column.
= Date.EndOfWeek(Date.AddDays(#date([Year],1,1), ([Week]-1)*7))
Pat
- CNENFRNL
Community Champion
Date.StartOfWeek(Date.AddDays(#date([Yr],1,1), ([Wk]-1)*7))is more robust, say, 2000/12/31 falls in the 54th week of the year.
- MH3
Helper V
Well mahoneypat
I have used your formula but (it gives me wrong EndOFWeek Number)
I have a week number as (Week 53 2020)
which is Starting on Dec 28, 2020 and Ending on Jan. 3, 2021
How to relate Calendar table and my Weekly fact table?
- AnonymousNot applicable
Hi PowerMarra ,
Does the replies above solve your problem? If it has been solved, please mark the correct reply as the standard answer to help the other members find it more quickly.Thank you very much for your kind cooperation!
Hope it helps,
Community Support Team _ CaitlynIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.