Forum Discussion
Week Start calculation
- 8 years ago
Ok...so this appears to work and do what I need:
WeekStart
= Table.AddColumn(#"WeekStart", each Date.ToText(Date.StartOfWeek([Date], Day.Sunday),"MM/dd/yyyy"))
WeekStart_WeekEnd
= Table.AddColumn(#"WeekStart_WeekEnd", each Date.ToText(Date.StartOfWeek([Date], Day.Sunday),"MM/dd/yyyy") & "-" & Date.ToText(Date.EndOfWeek([Date], Day.Sunday),"MM/dd/yyyy"))
I'll leave this here so the next person trying this can hopefully find it and not bang their head for a full day.
I appreciate all the help.
Hi
The below Dax will help to get the week start date. I am assuming that Sunday is your week start date.
WeekStartDate = Sheet2[Date]- WEEKDAY(Sheet2[Date],1)+1 // Sunday as Week start date
WeekStartDate = Sheet2[Date]- WEEKDAY(Sheet2[Date],2)+1 // Monday as Week start date
Hope this is what you are looking for.
Thansk
Raj
Can you please help me understand how to use your DAX example? Is it for a column or Table or Measure? Is Sheet2 the name of the table? and [Date] the name of the Date field in the Table? I am unable to figure out how to get it to work.