Forum Discussion
Creating relationships between weeks, years, and a date table
- 3 years ago
Made a 'Date" Column in my Data Tables that uses the week and year number to get the date of the start of that week.
Date.StartOfWeek(Date.AddWeeks(#date([Year], 1, 1), [Week]-1), Day.Monday)
Then I linked the date column in my calendar table to the date column in my data tables.
Sorry, I have a date table I forgot to put it in the post.
I woukd Fix the Calendar table because the "Year" is already included in the calendar table so you don't need to have it as a Dimension, the same for week.
- kylerwimbush3 years agoHelper I
Then I wouldn't be able to connect the Values I have in my Year and Week tables to the calendar table.
I also can't directly connect my calendar table to my data tables because that would introduce a many to many relationship which wouldn't work.
- Uspace873 years agoResolver III
You Can Create a new table passing this code:
Calendar = ADDCOLUMNS(CALENDARAUTO (),"Year", YEAR ( [Date] ),"Quarter", "Q" & QUARTER ( [Date] ),"Month", FORMAT ( [Date], "mmmm" ),"Month Number", MONTH ( [Date] ),"WeekNumber" , WEEKNUM([Date]))