Forum Discussion
MH3
4 years agoHelper V
Getting Date from Week Number and Year
Hi, I have a fact table in which I have Week Number and Year wise Sales I want to create a relationship of fact table with my calendar Table (Which have all dates from Year 2020 and 2021...
- 4 years ago
It's working well 🙂
MH3
4 years agoHelper V
Actually, The data was given on Week-Year basis
so I had splitted the week and year
= (TheYear as number, TheWeek as number) as date =>
let
//test
//TheYear = 2018,
//TheWeek = 1,
//
offsetToISO = Date.AddDays(#date(TheYear,1,1),-4),
dayOfWeek = Date.DayOfWeek(offsetToISO, Day.Monday),
offset = -dayOfWeek + (TheWeek * 7),
isoWeekDate = Date.AddDays(offsetToISO, offset)
in
isoWeekDate
and the StartWeek I had calculated by this Function
Syndicate_Admin
4 years agoAdministrator
Hi
@Syndicate_Admin
This function worked for me to calculate StartWeek
Thanks!