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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
malualves
Frequent Visitor

Sort week start and end by week-year

malualves_0-1638403695580.png

I have a calendar table with a column with "Week Start End" (28/11 - 4/11 is an example of a line....etc). I want to sort by year-week (2021-1, 2021-2...etc). The problem is when I have one week in the end/start of a year. For example, the last week of 2020 begins in 28/12/2020 and end in 03/01/2021. In this case, I have two values of year-week for the week 28/12 - 03/01) (image above). How can i sort the column Week Star End"?

 

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @malualves 

You can try to sort directly by start of week or end of week in your data.

 

Sort Column = 
RANKX('Table',[Start of Week],,DESC,Dense)

 

 

Result:

vangzhengmsft_0-1638763534543.png

 

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

View solution in original post

2 REPLIES 2
v-angzheng-msft
Community Support
Community Support

Hi, @malualves 

You can try to sort directly by start of week or end of week in your data.

 

Sort Column = 
RANKX('Table',[Start of Week],,DESC,Dense)

 

 

Result:

vangzhengmsft_0-1638763534543.png

 

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

amitchandak
Super User
Super User

@malualves , I prefer to sort on week start or week end date

 

Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)

 

I would mark one of the two as sort column

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors