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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
7ea8ea
Helper III
Helper III

Filtering Data from the previous x weeks (Monday to Sunday)

Hi All,

 

When I filter the number of previous weeks in Query, Power BI takes one week as Sunday to Saturday. Is there a way for me to set or change it so that Power BI reads one week as Monday to Sunday? Thanks in advance for the help

 

Best Regards

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @7ea8ea ,

 

You can create a column by WEEKNUM:

WEEKNUM = WEEKNUM('Table'[Date],2)

 Week begins on Monday. Weekdays are numbered 1 through 7.

 

And you can use measure like below to filter the number of previous weeks.

 

Measure = CALCULATE(SUM('Table'[column]),FILTER('Table','Table'[WEEKNUM] = WEEKNUM(Today())- selectednumber)))

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

 

amitchandak
Super User
Super User

@7ea8ea , Create a date table with Week columns like these

New columns

Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)	

 

New measures

This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))

 

refer Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors