Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
msommerf
Helper III
Helper III

DAX - If Today is the last Monday of the month.

I have the following scenario that I am hoping somebody can help with?

I have a Power BI report on which I would like to display some set text if today is the last Monday of the Month.

Is there a way I can check if Today() is the last Monday of the current month, if yes display 1 else 0?

The report does not have a date table as the data displayed does not have any dates in it.

Any assitance appreciated.

1 ACCEPTED SOLUTION

@msommerf 
Oh srry did not read carefully. Please try

=
VAR TodayDate =
    TODAY ()
VAR StartOfTheMonth =
    EOMONTH ( TodayDate, -1 ) + 1
VAR EndOfTheMonth =
    EOMONTH ( TodayDate, 0 )
VAR T1 =
    CALENDAR ( StartOfTheMonth, EndOfTheMonth )
VAR T2 =
    ADDCOLUMNS ( T1, "@Weekday", WEEKDAY ( [Date], 2 ) )
VAR T3 =
    FILTER ( T2, [@Weekday] = 1 )
VAR LastMonday =
    MAXX ( T3, [Date] )
RETURN
    IF ( TodayDate = LastMonday, 1, 0 )

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @msommerf 

you check that using

IF ( WEEKDAY ( TODAY ( ), 2 ) = 1, 1, 0 )

Won't that only tell me if today is a Monday? It won't tell me if it is the last Monday of the month.

@msommerf 
Oh srry did not read carefully. Please try

=
VAR TodayDate =
    TODAY ()
VAR StartOfTheMonth =
    EOMONTH ( TodayDate, -1 ) + 1
VAR EndOfTheMonth =
    EOMONTH ( TodayDate, 0 )
VAR T1 =
    CALENDAR ( StartOfTheMonth, EndOfTheMonth )
VAR T2 =
    ADDCOLUMNS ( T1, "@Weekday", WEEKDAY ( [Date], 2 ) )
VAR T3 =
    FILTER ( T2, [@Weekday] = 1 )
VAR LastMonday =
    MAXX ( T3, [Date] )
RETURN
    IF ( TodayDate = LastMonday, 1, 0 )

Hi @tamerj1 . This is prefect and works a treat. Many thanks for your help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.