![]() with those 2 dates you can add column based on date button "Substract days" and adding 1 (day) getEndDateFromWeekinYear: return the last day of a week based on last day in year and take as input a week in format YYYY-W# (i.e. getStartDateFromWeekinYear: return the 1st day of week based on first day of a year and take as input a week in format YYYY-W# (i.e. I've written 2 PowerQuery functions based on : Personally, I prefer to do these kind of transformations in PowerQuery instead of DAX. Hopefully, this provides what you are looking for. Here is a screenshot of the resulting table (the weeknum iso column can be used accordingly): Now you can use this DAX Statement to find the starting date of the week in your existing table: Startdate Calendar =ĬALCULATE(MIN('Simple Date'), 'Simple Date' = _Weeknum)Īnd this to find the enddate: Enddate Calendar =ĬALCULATE(MAX('Simple Date'), 'Simple Date' = _Weeknum) , "weeknum iso", WEEKNUM('', 21) //returns the weeknum based on ISO 8601 , "weeknum", WEEKNUM('', 2) //week begins on Monday ![]() In addition, you can consider using a Date Table that is not related, this DAX creates a Date table for the year 2020: Simple Date = ![]() If you assume that week one starts always with the 1st of January.įor the latter you can use this DAX statement to create a calculated column that creates the startdate: StartDate =ĭATE(_year, 1, 1) + ('Table' - 1 ) * 7Īnd this to create a calculated column that represents the enddate: EndDate =ĭATE(_year, 1, 1) + ('Table' - 1 ) * 7 + 6 Hey guess it's almost impossible without additional information like the year, or it is very much simplified. ![]()
0 Comments
Leave a Reply. |