Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don'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.

Reply
lmpb1988
Frequent 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 to know if there is a way when I open the powerbi file that the week number can be updated automatically and not manually.
For example, I can set the filter between week 1 and week 52 (last week of the year) and all the data will appear, but I would like it to calculate the current week automatically and not have it inputted automatically. manually.

For example, at this moment, when I open the file I have, the filter is from week 1 to week 21, according to the image I added, and I can only change this if I do it manually.

 

Thanks

 

numweeked.jpg

1 ACCEPTED SOLUTION

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.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

4 REPLIES 4
lmpb1988
Frequent Visitor

Tks, that works.

lmpb1988
Frequent Visitor

But a measure can't be added to a field right?

 

numweeked.jpg

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.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






bhanu_gautam
Super User
Super 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




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.