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.
Hello.
I want to retrieve the next second tuesday of the next month from today. How can I achieve this in DAX please ?
For example, next 2nd tuesday is the 14th on February.
Thank's in advance
Solved! Go to Solution.
Hi @Neandril ,
Here I suggest you to try this code to create a calculated column or a measure.
New =
VAR _NextMonthFirstDay =
EOMONTH ( TODAY (), 0 ) + 1
VAR _WeekdayOfFirstDay =
WEEKDAY ( _NextMonthFirstDay, 2 )
RETURN
IF (
_WeekdayOfFirstDay > 2,
_NextMonthFirstDay - _WeekdayOfFirstDay + 16,
_NextMonthFirstDay - _WeekdayOfFirstDay + 9
)
Here I have a test on a Date table, it works.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Neandril , Create a new column or measure as per need
New =var _nx = EOMONTH(TODAY(),0)+1
return _nx -WEEKDAY(_nx,2) +16
Thank's for this.
However, it "partially" works. On some months, it returns incorrect values (I created a calendar table for test purpose). Last November, it should be the 8th, but this formula returns the 15th.
Hi @Neandril ,
Here I suggest you to try this code to create a calculated column or a measure.
New =
VAR _NextMonthFirstDay =
EOMONTH ( TODAY (), 0 ) + 1
VAR _WeekdayOfFirstDay =
WEEKDAY ( _NextMonthFirstDay, 2 )
RETURN
IF (
_WeekdayOfFirstDay > 2,
_NextMonthFirstDay - _WeekdayOfFirstDay + 16,
_NextMonthFirstDay - _WeekdayOfFirstDay + 9
)
Here I have a test on a Date table, it works.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
45 | |
31 | |
30 | |
18 | |
17 |