Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi Community,
Is it possible to create a variable within a measure that returns the date of the last Thursday of the current month dynamically, so for example, we are now in October 2022 and the date of the last Thursday of this month is 27th October 2022. Next month it will be 24th November 2022 etc.
Preferably, this would be calculated independant of any tables if possible?
Solved! Go to Solution.
Figured it out:
VAR __Start = DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 )
VAR __END = EOMONTH ( TODAY (), 0 )
VAR __LastThursdayofCurrentMonth =
MAXX (
FILTER (
ADDCOLUMNS ( CALENDAR ( __Start, __END ), "Day", WEEKDAY ( [Date] ) ),
[Day] = 5
),
[Date]
)
Figured it out:
VAR __Start = DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 )
VAR __END = EOMONTH ( TODAY (), 0 )
VAR __LastThursdayofCurrentMonth =
MAXX (
FILTER (
ADDCOLUMNS ( CALENDAR ( __Start, __END ), "Day", WEEKDAY ( [Date] ) ),
[Day] = 5
),
[Date]
)
i
If you have a date table make sure that you have the Weekday number (Weekday(Date[date])
and after the measure is :
calculate(max(date[date]), Weekday=4)