Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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 now. For example when I put the data on a matrix I see the following dates
12/15/2019 , 12/22/2019 - which are my week start dates

but I would like to see 12/14/2019 , 12/21/2019, 12/28/2019 instead which are my week ending dates.  Any ideas how to achieve that?

Thank youuu!!

 
  • 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.

9 Replies