Forum Discussion
lmpb1988
2 years agoFrequent Visitor
Update week number automatically
Hi In power bi I have a data segmentation visual based on the week number, which in turn takes the week number information from a calendar table. The filter is working correctly but I would like...
- 2 years ago
Apply the Filter to Your Visual:
Go to the visual where you want to apply the filter.
Drag the IsCurrentWeek measure to the Filters pane.
Set the filter to show only items where IsCurrentWeek is TRUE.
bhanu_gautam
2 years agoSuper User
lmpb1988 , For this you can create a measure first make sure you have a date table with week number
Calendar =
ADDCOLUMNS (
CALENDAR (DATE(2023, 1, 1), DATE(2023, 12, 31)),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"Week Number", WEEKNUM([Date], 2) -- 2 indicates that the week starts on Monday
)
Then create a new column in this date table to calculate current week
CurrentWeek =
IF (
YEAR(TODAY()) = [Year],
WEEKNUM(TODAY(), 2),
BLANK()
)
Then create a measure for current week
CurrentWeekMeasure = WEEKNUM(TODAY(), 2)
Use this instead of Numweeked