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

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

Reply
aralbrecht
New Member

Sort by column error

Hello all,

 

I am attempting to create a line chart by week that spans multiple years. I would like Week 52 of 2019 to show up before Week 1 of 2020 on the X-axis.

 

In column A I have all possible dates for each year. In column B, I have a "Week 1, Week 2, Week 3, etc." assigned to a day, with each Week repeating 7 times. In column C, I have a field that is the year-month-day combo in the format YYYYMMDD.

 

When trying to sort column B (Week data) by column C, I receieve the error:

 

We can't sort the 'Week" column by 'YearMonthDay.' There can't be more than one value in "YearMonthDay' for the same value in 'Week'. Please choose a different column for sorting or update the data in 'YearMonthDay'.

 

I have read other forum posts, but I believe this issue is different. I have even looked at the data in an Excel PivotTable, and can confirm there is not more than 1 count of any YearMonthDay value.

 

Can anyone assist? Thanks in advance!

2 REPLIES 2
amitchandak
Super User
Super User

You sort YYYYWW or week start date. Please refer this file

https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0

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

This is the same issue. What is happening is column C is at the daily granularity level - YYYYMMDD, so 365/366 values per year. But your week is obviously only at the week level, so 52/53 values per year. Your column C needs to be the week number. You can get this easily in your date table in Power Query using Date.WeekOfYear([Date]), or in DAX using WEEKNUM() if your date table was generated in DAX.

 

The Sort By column has to have the EXACT same number of distinct values as the column you are sorting. Not one more, not one less. Or it won't work. Has to be a 1:1 relationship.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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