Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
IsInCurrentWeek returns a logical value indicating whether the given Date occurred during the current week, as determined by the current date and time on the system.
Unfortunately the weeks start on Sunday when my weeks actually start on Monday.
What would be your suggestion as for tweaking this in order for IsInCurrentWeek to use Monday instead of Sunday as the first day of the week?
Solved! Go to Solution.
yep, that's what I ended up with
#"real Week" = Table.SelectRows(Source, each Duration.Days(Duration.From(Today-[Date]))< Date.DayOfWeek(Today)),
thanks all for putting me on the right track!
You could add something like this to your DATE table
Weeks From Today =
VAR Offset = WEEKDAY('Dates'[Date],2)
RETURN INT((Today() - ('Dates'[Date] - Offset) ) /7)
The current week will always carry a 0 (And this has been aligned to a Monday start.
This approach has the bonus that you can use the column in your filters and set Report/Page or Visual level filters to only show data for when this is between 0 and 13 if you want a rolling set of weeks.
I think this is a good track but I want to do it in the back-end, in M not in DAX
Subtract 1 day from your date: Date.IsInCurrentWeek(YourDate - #duration(1,0,0,0))
Actually here's a link to something related
Actually, the first day of the week is culture dependent.
A better solution would be (in this example a column is added indicating if the date is in the current week):
= Table.AddColumn(PreviousStep, "InCurrentWeek", each [YourDate] >= Date.StartOfWeek(DateTime.Date(DateTime.LocalNow()), Day.Monday) and [YourDate] <= Date.EndOfWeek(DateTime.Date(DateTime.LocalNow()), Day.Monday))
yep, that's what I ended up with
#"real Week" = Table.SelectRows(Source, each Duration.Days(Duration.From(Today-[Date]))< Date.DayOfWeek(Today)),
thanks all for putting me on the right track!
User | Count |
---|---|
116 | |
73 | |
60 | |
48 | |
48 |
User | Count |
---|---|
171 | |
122 | |
60 | |
59 | |
56 |