Forum Discussion
Anonymous
6 years agoNot applicable
Week grouping
Hi guys, I'm trying to group my dates by week and used the Grouping function and it worked ok. But I'd like to group by the week ending date and not by the week starting like it is doing right no...
- 6 years ago
Hi Anonymous
Try this Column.
Column 2 = VAR __yearWeek = FORMAT( 'Calendar'[Date], "YYYYWW" ) RETURN CALCULATE( MAX( 'Calendar'[Date] ), ALL( 'Calendar' ), FORMAT( 'Calendar'[Date], "YYYYWW" ) = __yearWeek )Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
v-lili6-msft
6 years agoCommunity Support
hi Anonymous
You could use this formula to create a calculate column as below:
New week = var _bin= INT(DATEDIFF(DATE(2019,12,14),'Date'[Date],DAY)/7) return
CALCULATE(MIN('Date'[Date]),FILTER('Date', INT(DATEDIFF(DATE(2019,12,14),'Date'[Date],DAY)/7)=_bin))
Result:
and here is sample pbix file, please try it.
Regards,
Lin