Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Team,
If my date is not equal to monday then I want next weeks Monday date, how to achieve this.
Here my out put is 02/14/2024 which is Wednesday so I want 02/19/2024.
If my out put date was 02/12/2024 as its Monday I want the it as it is.
Please help me.
Thanks!
Rakesh
Solved! Go to Solution.
Try this dax:
NextMonday =
VAR CurrentDate = MAX(EU_OMP_PROD_LOC_PLANVIEN_DAILYFACT[SNAPSHOT_DATE ])
VAR DayOfWeek = WEEKDAY(CurrentDate, 2)
VAR DaysToAdd = IF(DayOfWeek <> 1, 8 - DayOfWeek, 0)
RETURN CurrentDate + DaysToAdd
learn more about dashboard and domain on below blog:
https://analyticpulse.blogspot.com
Hi @Rakeshss ,
Thanks for the reply from @AnalyticPulse .
In Power Query:
Enter the following code:
= let
InputDate = #date(2024,2,14),
DayOfWeek = Date.DayOfWeek(InputDate, Day.Monday),
DaysToAdd = if DayOfWeek = 0 then 0 else 7 - DayOfWeek,
NextMonday = Date.AddDays(InputDate, DaysToAdd)
in
NextMonday
The page effect is shown below.
There is a downside to this, the date is hard coded.
So I created some sample data:
2024/5/12 |
2024/5/13 |
2024/5/14 |
2024/5/15 |
2024/5/16 |
2024/5/17 |
2024/5/18 |
2024/5/19 |
2024/5/20 |
Create a custom column with the following syntax:
if Date.DayOfWeek([Date], Day.Monday) = 0 then [Date] else Date.AddDays([Date], 7 - Date.DayOfWeek([Date], Day.Monday))
The page effect is shown below.
The pbix file is attached.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @Rakeshss ,
Thanks for the reply from @AnalyticPulse .
In Power Query:
Enter the following code:
= let
InputDate = #date(2024,2,14),
DayOfWeek = Date.DayOfWeek(InputDate, Day.Monday),
DaysToAdd = if DayOfWeek = 0 then 0 else 7 - DayOfWeek,
NextMonday = Date.AddDays(InputDate, DaysToAdd)
in
NextMonday
The page effect is shown below.
There is a downside to this, the date is hard coded.
So I created some sample data:
2024/5/12 |
2024/5/13 |
2024/5/14 |
2024/5/15 |
2024/5/16 |
2024/5/17 |
2024/5/18 |
2024/5/19 |
2024/5/20 |
Create a custom column with the following syntax:
if Date.DayOfWeek([Date], Day.Monday) = 0 then [Date] else Date.AddDays([Date], 7 - Date.DayOfWeek([Date], Day.Monday))
The page effect is shown below.
The pbix file is attached.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Yes just use the same logic as above dax
Try this dax:
NextMonday =
VAR CurrentDate = MAX(EU_OMP_PROD_LOC_PLANVIEN_DAILYFACT[SNAPSHOT_DATE ])
VAR DayOfWeek = WEEKDAY(CurrentDate, 2)
VAR DaysToAdd = IF(DayOfWeek <> 1, 8 - DayOfWeek, 0)
RETURN CurrentDate + DaysToAdd
learn more about dashboard and domain on below blog:
https://analyticpulse.blogspot.com
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
88 | |
85 | |
68 | |
68 | |
64 |
User | Count |
---|---|
209 | |
118 | |
116 | |
81 | |
74 |