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.
Hey,
I am looking for some DAX to use in a measure , which will return the date of the next Wednesday. which I want to display in a tile in the report
I have tried the below but it is not very graceful and additionally it doesn't work (it needs a column cannot use today()).
Does anyone have any ideas?
Solved! Go to Solution.
@Anonymous
If you are calculating "next wednesday" based on today's date, try this:
Please change the “;” to “,” in the measure
Next wednesday =
VAR weeknumtod = WEEKDAY(TODAY())
Return
IF(weeknumtod<5; TODAY()+4-weeknumtod; IF(weeknumtod <8; TODAY() +8-weeknumtod + 3))
You may have to tweak it depending on the date you wish to see if today is actually "wednesday" (whether you want to see today's date, or next week's wednesday's date)
Next wednesday (hard coded "today") =
VAR seldate = DATE(2019;11;16)
VAR weeknumtod = WEEKDAY(seldate)
Return
IF(weeknumtod<5; seldate +4-weeknumtod; IF(weeknumtod <8; seldate +8-weeknumtod + 3))
Proud to be a Super User!
Paul on Linkedin.
@Anonymous
If you are calculating "next wednesday" based on today's date, try this:
Please change the “;” to “,” in the measure
Next wednesday =
VAR weeknumtod = WEEKDAY(TODAY())
Return
IF(weeknumtod<5; TODAY()+4-weeknumtod; IF(weeknumtod <8; TODAY() +8-weeknumtod + 3))
You may have to tweak it depending on the date you wish to see if today is actually "wednesday" (whether you want to see today's date, or next week's wednesday's date)
Next wednesday (hard coded "today") =
VAR seldate = DATE(2019;11;16)
VAR weeknumtod = WEEKDAY(seldate)
Return
IF(weeknumtod<5; seldate +4-weeknumtod; IF(weeknumtod <8; seldate +8-weeknumtod + 3))
Proud to be a Super User!
Paul on Linkedin.
Hi @Anonymous
Try this (where 'Table'[Column1] is your date column reference):
Next Wednesday =
VAR SelDate = SELECTEDVALUE ( 'Table'[Column1] )
VAR DayNo = WEEKDAY ( SelDate )
VAR NextWed =
SWITCH (
TRUE(),
DayNo = 1, SelDate+3,
DayNo = 2, SelDate+2,
DayNo = 3, SelDate+1,
DayNo = 4, SelDate+7,
DayNo = 5, SelDate+6,
DayNo = 6, SelDate+5,
DayNo = 7, SelDate+4
)
RETURN NextWed
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |