Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How Many Certain Weekdays are in a Month

Probably has been discussed, but looking for some assistance as i have not found anything online.  Is there a way to add a custom column to a specific date (ex. 9/1/2021) and it returns how many "Mondays" are in that month?

 

 

  • Here is a DAX column expression that shows one way to do it.  Replace T1 with your actual table name.  Note that you should make your column type Date instead of type DateTime.

     

    Mondays =
    VAR thisdate = T1[Week]
    VAR thisEOM =
        EOMONTH ( thisdate0 )
    VAR thisCalendar =
        CALENDAR ( thisdatethisEOM )
    VAR result =
        COUNTROWS ( FILTER ( thisCalendarWEEKDAY ( [Date] ) = 2 ) )
    RETURN
        result

     

    Pat