Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Last weekend in Month

Hi, I'm not able to find a solution. I'm trying to get the last Saturday in month. For example, July 2022 Sat ended on the 30th and Nov Saturday ended on 26th.   How do you calculate and get the ...
  • Greg_Deckler's avatar
    3 years ago

    Anonymous Try:

    Measure = 
      VAR __Date = MAX('Table'[Date])
      VAR __SoM = DATE(YEAR(__Date),MONTH(__Date),1)
      VAR __EoM = EOMONTH(__Date,0)
      VAR __Table = 
        ADDCOLUMNS(
          CALENDAR(__SoM, __EoM),
          "__WeekDay", WEEKDAY([Date],1)
        )
      VAR __Result = MAXX(FILTER(__Table, [__WeekDay] = 7),[Date])
    RETURN
      __Result